Write
To write a secret to a path on SecretHub, you can use the write
command:
secrethub write [options] <path>
This automatically encrypts your secret and writes it to a new version at the path you provide.
Depending on how you configure the command, it reads the secret from the following inputs:
- If the
--clip
flag is provided, it reads from the clipboard. - If input is piped, it reads from
stdin
, e.g.echo "hello world" | secrethub write path/to/secret
- If no other input is given, it aks you to type in the secret value.
Prompting for input normally ends after pressing
ENTER
. If the--multiline
flag is used, input continues until an EOF is reached (see flag details).
Arguments
-
<path>
(string) - The path to write the secret to. Note that secrets are append only, so
write
always creates a new version of a secret.
Flags
-
-c, --clip
(boolean) - Use clipboard content as input. This can be useful when copy-pasting a value from a graphical user interface.
-
--no-trim
(boolean) - Do not trim leading and trailing whitespace in the secret. Use this when you want to preserve the original content of the secret, regardless of whether your system adds a newline to the input (as is common on e.g. Posix systems).
-
-m, --multiline
(boolean) new in v0.31.0 - Prompt for multiple lines of input, until an EOF is reached.
On Linux/Mac, press
CTRL-D
to end input. On Windows, pressCTRL-Z
and thenENTER
to end input. If this flag is used, typed input is shown to the user. If multiline input should be hidden, please use a different input option (e.g. pipe input tostdin
, use the--in-file
, or use the--clip
flag).
-
-i, --in-file
(string) - Use the contents of this file as the value of the secret.