Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rust: implement support for non-UTF-8 data in store and lookup #521

Merged
merged 15 commits into from
Oct 2, 2024

Conversation

Esgrove
Copy link
Contributor

@Esgrove Esgrove commented Oct 2, 2024

Implement #246

  • Support lookup for non UTF-8 data
  • Support storing non UTF-8 data when storing a file
  • Support storing non UTF-8 data from stdin
  • Better handling for using filename as key
  • Allow reading stdin for value options as well in addition to --file

For example this works now and produces a working archive that can be extracted:

./vault lookup chat-letsencrypt.tar.gz > test.tar.gz

Other examples:

 ./vault store binarytest --file ../k-ruoka-bot-detection.pdf --overwrite
./vault lookup binarytest > test.pdf
# ^ pdf works rust git:(lookup-binary-data) ✗ cat ~/Documents/Lukkarila\ Akseli.xlsx | ./vault store xlsxtest --file -
Reading from stdin until EOF

./vault lookup xlsxtest > test.xlsx
# ^ excel worksrust git:(lookup-binary-data) ✗ ./vault store --file ~/Downloads/kube-course-exercises.zip
Using filename as key: 'kube-course-exercises.zip'rust git:(lookup-binary-data) echo "testingtesting" | ./vault store stdintest --file -
Reading from stdin until EOFrust git:(lookup-binary-data) ./vault lookup stdintest
testingtestingrust git:(lookup-binary-data) ✗ echo "testingtesting" | ./vault store --overwrite test -
Reading from stdin until EOFrust git:(lookup-binary-data) ./vault lookup test
testingtesting

New long help:

rust git:(lookup-binary-data) ./vault store --help
Store a new key-value pair in the vault.
You can provide the key and value directly, or specify a file to store.

Usage examples:
- Store a value: `vault store mykey "some value"`
- Store a value from args: `vault store mykey --value "some value"`
- Store from a file: `vault store mykey --file path/to/file.txt`
- Store from a file with filename as key: `vault store --file path/to/file.txt`
- Store from stdin: `echo "some data" | vault store mykey --value -`
- Store from stdin: `cat file.zip | vault store mykey --file -`

Usage: vault {store|--store|-s} [OPTIONS] [KEY] [VALUE]

Arguments:
  [KEY]
          Key name

  [VALUE]
          Value to store

Options:
  -w, --overwrite
          Overwrite existing key

  -v, --value <value>
          Value to store, use '-' for stdin

  -f, --file <filepath>
          File to store, use '-' for stdin

  -h, --help
          Print help (see a summary with '-h')

Short help:

rust git:(lookup-binary-data) ./vault store -h
Store a new key-value pair

Usage: vault {store|--store|-s} [OPTIONS] [KEY] [VALUE]

Arguments:
  [KEY]    Key name
  [VALUE]  Value to store

Options:
  -w, --overwrite        Overwrite existing key
  -v, --value <value>    Value to store, use '-' for stdin
  -f, --file <filepath>  File to store, use '-' for stdin
  -h, --help             Print help (see more with '--help')

@Esgrove Esgrove changed the title Rust Lookup binary data Rust: implement support for non-UTF-8 data in store and lookup Oct 2, 2024
@Esgrove Esgrove merged commit a6b61c5 into master Oct 2, 2024
6 checks passed
@Esgrove Esgrove deleted the lookup-binary-data branch October 2, 2024 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant