MatrixAI / Polykey-CLI

Polykey CLI - Open Source Decentralized Secret Sharing System for Zero Trust Workflows
https://polykey.com
GNU General Public License v3.0
5 stars 3 forks source link

Implement `secrets cat` command #243

Open tegefaulkes opened 3 weeks ago

tegefaulkes commented 3 weeks ago

Specification

As per the #32 issue refactor, we need to implement a simplified cat command as secrets cat.

This will function identically to cat while omitting some of the options for now. It pretty much combines the functionality of read and write commands along with the concatination cat is known for.

Uses are

  1. read the contents of a secret secrets cat secretPath or file secrets cat filePath.
  2. write the stdin to a secret cat > secretPath or file cat > filePath. stdin will support pipes as well.
  3. concatenating files together in the output. secrets cat secretPath filePath secretPath/*.

Pretty much the the functionality boils down to two things

  1. Will output the contents of all specified files to stdout in the order they are specified.
  2. If no files are specified then it will just output stdin to stdout.

Redirection into a secret path might not be possible with how commander parses inputs and how shell works, at least, not with the cat > secretPath syntax. We'll need to prototype that. If it doesn't work, we'd have to use an option --redirect secretPath to enable the functionality.

Additional context

Related #32

Tasks

  1. Create a secrets cat command
  2. If no arguments are provided it will take stdin and output to stdout.
  3. If arguments are provided it will write their contents to stdout in the order they are provided.
  4. Support specifying normal files along side secret paths.
  5. Support specifying wildcards and possibly globbing for the paths.
  6. Support redirecton into a secret using > secretPath syntax. Failing that provide an option that handles that behaviour.
linear[bot] commented 3 weeks ago

ENG-356 Implement `secrets cat` command