secrethub/secrethub-cli

Add --template flag to inject command

SimonBarendse opened this issue · 3 comments

When using a template from a file (which is the large majority of use-cases), you currently have to cat the file and pipe it to the inject command:

cat env.tpl | secrethub inject

Like with #35, not all environments work nicely with pipes. For example, in a docker image, we prefer a single call to a binary over the shell form of the command.

Therefore, I propose to add a --template-file flag that can be used as an alternative input to stdin.

--template-file (string)

   Use the contents of a file as template. 

And the order in which the command reads the template from different inputs would change to:

  1. --template-file
  2. If input is piped, read from stdin
  3. Error if no other input is given

Nice, love how we can make all these forms of input consistent. To be consistent with other commands, consider naming the flag either --template or --input-file (I much prefer --template)

Yes, let's make it --template, as this is also the name we use for this flag in the run command.

An --in-file flag is added in v0.24.0.