From 02be26e4aeb3a6328761b74b193e00cef3fdad2e Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Fri, 1 Apr 2016 16:50:12 -0400 Subject: [PATCH] Fix up the meta common options text function to not strip leading space and fix up commands --- command/audit_disable.go | 3 +-- command/audit_enable.go | 4 +--- command/audit_list.go | 3 +-- command/auth_disable.go | 3 +-- command/auth_enable.go | 4 +--- command/capabilities.go | 3 +-- command/delete.go | 3 +-- command/generate-root.go | 4 +--- command/init.go | 4 +--- command/key_status.go | 3 +-- command/list.go | 4 +--- command/mount.go | 4 +--- command/mounts.go | 3 +-- command/mounttune.go | 4 +--- command/path_help.go | 3 +-- command/policy_delete.go | 3 +-- command/policy_list.go | 3 +-- command/policy_write.go | 3 +-- command/read.go | 4 +--- command/rekey.go | 4 +--- command/remount.go | 3 +-- command/renew.go | 4 +--- command/revoke.go | 4 +--- command/rotate.go | 3 +-- command/seal.go | 3 +-- command/ssh.go | 4 +--- command/status.go | 3 +-- command/step-down.go | 3 +-- command/token_create.go | 4 +--- command/token_lookup.go | 4 +--- command/token_renew.go | 4 +--- command/token_revoke.go | 4 +--- command/unmount.go | 3 +-- command/unseal.go | 4 +--- command/write.go | 4 +--- meta/meta.go | 9 ++++----- 36 files changed, 39 insertions(+), 93 deletions(-) diff --git a/command/audit_disable.go b/command/audit_disable.go index bdace6f001..0dae565cf9 100644 --- a/command/audit_disable.go +++ b/command/audit_disable.go @@ -65,7 +65,6 @@ Usage: vault audit-disable [options] id type of the backend). General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/audit_enable.go b/command/audit_enable.go index adeb382040..21f5f23a49 100644 --- a/command/audit_enable.go +++ b/command/audit_enable.go @@ -96,9 +96,7 @@ Usage: vault audit-enable [options] type [config...] Example: vault audit-enable file path=audit.log General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Audit Enable Options: -description= A human-friendly description for the backend. This diff --git a/command/audit_list.go b/command/audit_list.go index f0b55bc407..20c070f132 100644 --- a/command/audit_list.go +++ b/command/audit_list.go @@ -79,7 +79,6 @@ Usage: vault audit-list [options] only a root Vault user can view this. General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/auth_disable.go b/command/auth_disable.go index f3a4503844..a8783067d2 100644 --- a/command/auth_disable.go +++ b/command/auth_disable.go @@ -64,7 +64,6 @@ Usage: vault auth-disable [options] path If the command is exited early, the tokens will still be revoked. General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/auth_enable.go b/command/auth_enable.go index 9c55197cab..882d97985d 100644 --- a/command/auth_enable.go +++ b/command/auth_enable.go @@ -72,9 +72,7 @@ Usage: vault auth-enable [options] type access Vault. General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Auth Enable Options: -description= Human-friendly description of the purpose for the diff --git a/command/capabilities.go b/command/capabilities.go index d2d5a3e03a..bb60bd4ea8 100644 --- a/command/capabilities.go +++ b/command/capabilities.go @@ -82,7 +82,6 @@ Usage: vault capabilities [options] [token] path is invalid, this command will respond with a ["deny"]. General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/delete.go b/command/delete.go index 596b12bed1..c5105bbc70 100644 --- a/command/delete.go +++ b/command/delete.go @@ -62,7 +62,6 @@ Usage: vault delete [options] path whether delete is supported for a path and what the behavior is. General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/generate-root.go b/command/generate-root.go index 04246ecf1b..08a4252582 100644 --- a/command/generate-root.go +++ b/command/generate-root.go @@ -315,9 +315,7 @@ Usage: vault generate-root [options] [key] final token value will be encrypted with this public key and base64-encoded. General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Rekey Options: -init Initialize the root generation attempt. This can only diff --git a/command/init.go b/command/init.go index 35f9c62963..61a5e17ab5 100644 --- a/command/init.go +++ b/command/init.go @@ -106,9 +106,7 @@ Usage: vault init [options] This command can't be called on an already-initialized Vault. General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Init Options: -check Don't actually initialize, just check if Vault is diff --git a/command/key_status.go b/command/key_status.go index 9140e5f6e2..ff1b0860c6 100644 --- a/command/key_status.go +++ b/command/key_status.go @@ -50,7 +50,6 @@ Usage: vault key-status [options] the current key term and the key installation time. General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/list.go b/command/list.go index 7701933f00..0573c9b1b9 100644 --- a/command/list.go +++ b/command/list.go @@ -83,9 +83,7 @@ Usage: vault list [options] path and endpoint-specific. General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Read Options: -format=table The format for output. By default it is a whitespace- diff --git a/command/mount.go b/command/mount.go index 919317bee7..bfdba87591 100644 --- a/command/mount.go +++ b/command/mount.go @@ -83,9 +83,7 @@ Usage: vault mount [options] type secrets. General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Mount Options: -description= Human-friendly description of the purpose for diff --git a/command/mounts.go b/command/mounts.go index 7850cf8ee0..823aa57e75 100644 --- a/command/mounts.go +++ b/command/mounts.go @@ -86,7 +86,6 @@ Usage: vault mounts [options] A TTL of 'system' indicates that the system default is being used. General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/mounttune.go b/command/mounttune.go index 5f335aa48c..c90fa781b2 100644 --- a/command/mounttune.go +++ b/command/mounttune.go @@ -71,9 +71,7 @@ func (c *MountTuneCommand) Help() string { Example: vault mount-tune -default-lease-ttl="24h" secret General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Mount Options: -default-lease-ttl= Default lease time-to-live for this backend. diff --git a/command/path_help.go b/command/path_help.go index 3983f32e71..27d1313c5f 100644 --- a/command/path_help.go +++ b/command/path_help.go @@ -71,7 +71,6 @@ Usage: vault path-help [options] path the mount points of the backends are unknown. General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/policy_delete.go b/command/policy_delete.go index b76d63615a..ff8342a625 100644 --- a/command/policy_delete.go +++ b/command/policy_delete.go @@ -60,7 +60,6 @@ Usage: vault policy-delete [options] name doesn't exist, it is identical to not being associated with that policy. General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/policy_list.go b/command/policy_list.go index ee9441325a..73cb9c5b4e 100644 --- a/command/policy_list.go +++ b/command/policy_list.go @@ -87,7 +87,6 @@ Usage: vault policies [options] [name] If a name of a policy is specified, that policy is outputted. General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/policy_write.go b/command/policy_write.go index 2592ae91b7..4f73ffe13f 100644 --- a/command/policy_write.go +++ b/command/policy_write.go @@ -84,7 +84,6 @@ Usage: vault policy-write [options] name path loaded from the file at the given path. General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/read.go b/command/read.go index aa15b4636b..39b8218554 100644 --- a/command/read.go +++ b/command/read.go @@ -101,9 +101,7 @@ Usage: vault read [options] path backends in use to determine key structure. General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Read Options: -format=table The format for output. By default it is a whitespace- diff --git a/command/rekey.go b/command/rekey.go index 4296fdd1b2..9f51030333 100644 --- a/command/rekey.go +++ b/command/rekey.go @@ -301,9 +301,7 @@ Usage: vault rekey [options] [key] keys be provided. General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Rekey Options: -init Initialize the rekey operation by setting the desired diff --git a/command/remount.go b/command/remount.go index c34d80f4fa..47d591beea 100644 --- a/command/remount.go +++ b/command/remount.go @@ -68,8 +68,7 @@ Usage: vault remount [options] from to Example: vault remount secret/ generic/ General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/renew.go b/command/renew.go index bbe436f2d0..37b97943ae 100644 --- a/command/renew.go +++ b/command/renew.go @@ -80,9 +80,7 @@ Usage: vault renew [options] id [increment] is not required to honor this request. General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Renew Options: -format=table The format for output. By default it is a whitespace- diff --git a/command/revoke.go b/command/revoke.go index b8dfe7886d..4367d6faff 100644 --- a/command/revoke.go +++ b/command/revoke.go @@ -82,9 +82,7 @@ Usage: vault revoke [options] id lightly. This option requires -prefix. General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Revoke Options: -prefix=true Revoke all secrets with the matching prefix. This diff --git a/command/rotate.go b/command/rotate.go index 7889369202..9da387370b 100644 --- a/command/rotate.go +++ b/command/rotate.go @@ -62,7 +62,6 @@ Usage: vault rotate [options] disruptive. General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/seal.go b/command/seal.go index 10153c8c8c..10d69a0d73 100644 --- a/command/seal.go +++ b/command/seal.go @@ -58,7 +58,6 @@ Usage: vault seal [options] This is the same as running "vault unseal -reset". General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/ssh.go b/command/ssh.go index 04537ab9b7..7dbf999c04 100644 --- a/command/ssh.go +++ b/command/ssh.go @@ -256,9 +256,7 @@ Usage: vault ssh [options] username@ip See [https://github.com/hashicorp/vault-ssh-agent] General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` SSH Options: -role Role to be used to create the key. diff --git a/command/status.go b/command/status.go index 3edec9d5b3..628d4f9f27 100644 --- a/command/status.go +++ b/command/status.go @@ -98,7 +98,6 @@ Usage: vault status [options] code also reflects the seal status (0 unsealed, 2 sealed, 1 error). General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/step-down.go b/command/step-down.go index 076a072aee..be445a8389 100644 --- a/command/step-down.go +++ b/command/step-down.go @@ -50,7 +50,6 @@ Usage: vault step-down [options] same node to re-grab the lock and become active again. General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/token_create.go b/command/token_create.go index bc3f5b3fb9..aac0bea0a1 100644 --- a/command/token_create.go +++ b/command/token_create.go @@ -109,9 +109,7 @@ Usage: vault token-create [options] If a role is specified, the role may override parameters specified here. General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Token Options: -id="7699125c-d8...." The token value that clients will use to authenticate diff --git a/command/token_lookup.go b/command/token_lookup.go index 2ba5128215..c1c62ef716 100644 --- a/command/token_lookup.go +++ b/command/token_lookup.go @@ -85,9 +85,7 @@ Usage: vault token-lookup [options] [token|accessor] '-accessor' flag. General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Token Lookup Options: -accessor A boolean flag, if set, treats the argument as an accessor of the token. Note that the response of the command when this is set, will not contain diff --git a/command/token_renew.go b/command/token_renew.go index ee441eb548..3f78cb37a8 100644 --- a/command/token_renew.go +++ b/command/token_renew.go @@ -98,9 +98,7 @@ Usage: vault token-renew [options] [token] [increment] well; otherwise it must be passed in via the '-increment' flag. General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Token Renew Options: -increment=3600 The desired increment. If not supplied, Vault will diff --git a/command/token_revoke.go b/command/token_revoke.go index fe08a8fa44..0398010e2c 100644 --- a/command/token_revoke.go +++ b/command/token_revoke.go @@ -101,9 +101,7 @@ Usage: vault token-revoke [options] [token|accessor] a token accessor always revokes the token along with it's child tokens. General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Token Options: -accessor A boolean flag, if set, treats the argument as an accessor of the token. diff --git a/command/unmount.go b/command/unmount.go index dd2e32d689..104255f145 100644 --- a/command/unmount.go +++ b/command/unmount.go @@ -62,7 +62,6 @@ Usage: vault unmount [options] path by this backend will be revoked and its Vault data will be deleted. General Options: - - ` + meta.GeneralOptionsUsage() +` + meta.GeneralOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/unseal.go b/command/unseal.go index b666d03817..ae56182335 100644 --- a/command/unseal.go +++ b/command/unseal.go @@ -115,9 +115,7 @@ Usage: vault unseal [options] [key] only exists to assist in scripting. General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Unseal Options: -reset Reset the unsealing process by throwing away diff --git a/command/write.go b/command/write.go index eef4166b88..e289da28ad 100644 --- a/command/write.go +++ b/command/write.go @@ -134,9 +134,7 @@ Usage: vault write [options] path [data] prefix the "@" with a slash: "\@". General Options: - - ` + meta.GeneralOptionsUsage() + ` - +` + meta.GeneralOptionsUsage() + ` Write Options: -f | -force Force the write to continue without any data values diff --git a/meta/meta.go b/meta/meta.go index cd07d0f57d..65e10fe204 100644 --- a/meta/meta.go +++ b/meta/meta.go @@ -12,7 +12,6 @@ import ( "net/http" "os" "path/filepath" - "strings" "github.com/hashicorp/errwrap" "github.com/hashicorp/vault/api" @@ -261,7 +260,7 @@ func GeneralOptionsUsage() string { -client-cert=path Path to a PEM encoded client certificate for TLS authentication to the Vault server. Must also specify - -client-key. Overrides the VAULT_CLIENT_CERT + -client-key. Overrides the VAULT_CLIENT_CERT environment variable if set. -client-key=path Path to an unencrypted PEM encoded private key @@ -270,8 +269,8 @@ func GeneralOptionsUsage() string { if set. -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. Verification will also be skipped + not recommended. Verification will also be skipped if VAULT_SKIP_VERIFY is set. - ` - return strings.TrimSpace(general) +` + return general }