From a8573a5c8dbcb6a78ce87a409015606b7e9dc2b8 Mon Sep 17 00:00:00 2001 From: Richard Ulmer <42150522+codesoap@users.noreply.github.com> Date: Mon, 4 Jan 2021 20:05:33 +0100 Subject: [PATCH] cmd/age: improve help text (#175) --- README.md | 14 ++++++++------ cmd/age/age.go | 16 +++++++++------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 8cd0e79..6d0f17b 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ An alternative interoperable Rust implementation is available at [github.com/str ``` Usage: - age -r RECIPIENT [-a] [-o OUTPUT] [INPUT] + age (-r RECIPIENT | -R PATH)... [-a] [-o OUTPUT] [INPUT] age --passphrase [-a] [-o OUTPUT] [INPUT] - age --decrypt [-i KEY] [-o OUTPUT] [INPUT] + age --decrypt [-i KEY]... [-o OUTPUT] [INPUT] Options: -o, --output OUTPUT Write the result to the file at path OUTPUT. @@ -40,11 +40,13 @@ RECIPIENT can be an age public key, as generated by age-keygen, ("age1...") or an SSH public key ("ssh-ed25519 AAAA...", "ssh-rsa AAAA..."). Recipient files contain one or more recipients, one per line. Empty lines -and lines starting with "#" are ignored as comments. +and lines starting with "#" are ignored as comments. "-" may be used to +read recipients from standard input. -KEY is a path to a file with age secret keys, one per line -(ignoring "#" prefixed comments and empty lines), or to an SSH key file. -Multiple keys can be provided, and any unused ones will be ignored. +KEY is a path to a file with age secret keys, one per line (ignoring "#" +prefixed comments and empty lines), or to an SSH key file. Multiple keys +can be provided, and any unused ones will be ignored. "-" may be used to +read keys from standard input. ``` ### Multiple recipients diff --git a/cmd/age/age.go b/cmd/age/age.go index 8af316f..dc4c6aa 100644 --- a/cmd/age/age.go +++ b/cmd/age/age.go @@ -32,9 +32,9 @@ func (f *multiFlag) Set(value string) error { } const usage = `Usage: - age -r RECIPIENT [-a] [-o OUTPUT] [INPUT] + age (-r RECIPIENT | -R PATH)... [-a] [-o OUTPUT] [INPUT] age --passphrase [-a] [-o OUTPUT] [INPUT] - age --decrypt [-i KEY] [-o OUTPUT] [INPUT] + age --decrypt [-i KEY]... [-o OUTPUT] [INPUT] Options: -o, --output OUTPUT Write the result to the file at path OUTPUT. @@ -51,11 +51,13 @@ RECIPIENT can be an age public key, as generated by age-keygen, ("age1...") or an SSH public key ("ssh-ed25519 AAAA...", "ssh-rsa AAAA..."). Recipient files contain one or more recipients, one per line. Empty lines -and lines starting with "#" are ignored as comments. +and lines starting with "#" are ignored as comments. "-" may be used to +read recipients from standard input. -KEY is a path to a file with age secret keys, one per line -(ignoring "#" prefixed comments and empty lines), or to an SSH key file. -Multiple keys can be provided, and any unused ones will be ignored. +KEY is a path to a file with age secret keys, one per line (ignoring "#" +prefixed comments and empty lines), or to an SSH key file. Multiple keys +can be provided, and any unused ones will be ignored. "-" may be used to +read keys from standard input. Example: $ age-keygen -o key.txt @@ -144,7 +146,7 @@ func main() { } if len(recipientFlags) == 0 && len(recipientsFileFlags) == 0 && !passFlag { logFatalf("Error: missing recipients.\n" + - "Did you forget to specify -r/--recipient or -p/--passphrase?") + "Did you forget to specify -r/--recipient, -R/--recipients-file or -p/--passphrase?") } if len(recipientFlags) > 0 && passFlag { logFatalf("Error: -p/--passphrase can't be combined with -r/--recipient.")