From 18a23c9bef986dc1e7a23561f77bad5f03a61fe5 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Tue, 30 Jun 2015 12:01:23 -0700 Subject: [PATCH] command: source general options docs from common source --- command/audit_disable.go | 15 +-------------- command/audit_enable.go | 13 +------------ command/audit_list.go | 15 +-------------- command/auth.go | 19 +------------------ command/auth_disable.go | 15 +-------------- command/auth_enable.go | 13 +------------ command/delete.go | 15 +-------------- command/init.go | 13 +------------ command/key_status.go | 15 +-------------- command/meta.go | 27 +++++++++++++++++++++++++++ command/mount.go | 13 +------------ command/mounts.go | 15 +-------------- command/path_help.go | 15 +-------------- command/policy_delete.go | 15 +-------------- command/policy_list.go | 15 +-------------- command/policy_write.go | 15 +-------------- command/read.go | 13 +------------ command/rekey.go | 13 +------------ command/remount.go | 15 +-------------- command/renew.go | 13 +------------ command/revoke.go | 13 +------------ command/rotate.go | 15 +-------------- command/seal.go | 15 +-------------- command/status.go | 15 +-------------- command/token_create.go | 13 +------------ command/token_renew.go | 13 +------------ command/token_revoke.go | 13 +------------ command/unmount.go | 15 +-------------- command/unseal.go | 13 +------------ command/write.go | 13 +------------ 30 files changed, 56 insertions(+), 384 deletions(-) diff --git a/command/audit_disable.go b/command/audit_disable.go index 47d6e7ee09..3c03dc6225 100644 --- a/command/audit_disable.go +++ b/command/audit_disable.go @@ -64,19 +64,6 @@ Usage: vault audit-disable [options] id General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. - -` + ` + generalOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/audit_enable.go b/command/audit_enable.go index ef000a5303..5f7b6a6e80 100644 --- a/command/audit_enable.go +++ b/command/audit_enable.go @@ -96,18 +96,7 @@ Usage: vault audit-enable [options] type [config...] General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. + ` + generalOptionsUsage() + ` Audit Enable Options: diff --git a/command/audit_list.go b/command/audit_list.go index 3eac40df24..398b6c8d26 100644 --- a/command/audit_list.go +++ b/command/audit_list.go @@ -79,19 +79,6 @@ Usage: vault audit-list [options] General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. - -` + ` + generalOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/auth.go b/command/auth.go index 39265dc93b..e42c05cbdd 100644 --- a/command/auth.go +++ b/command/auth.go @@ -261,24 +261,7 @@ Usage: vault auth [options] [token or config...] General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -client-cert=path Path to a PEM encoded client certificate for TLS - authentication to the Vault server. Must also specify - -client-key. - - -client-key=path Path to an unencrypted PEM encoded private key - matching the client certificate from -client-cert. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. + ` + generalOptionsUsage() + ` Auth Options: diff --git a/command/auth_disable.go b/command/auth_disable.go index 296a68cd39..04ce0adf85 100644 --- a/command/auth_disable.go +++ b/command/auth_disable.go @@ -63,19 +63,6 @@ Usage: vault auth-disable [options] path General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. - -` + ` + generalOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/auth_enable.go b/command/auth_enable.go index 969ebb08e5..afb73df508 100644 --- a/command/auth_enable.go +++ b/command/auth_enable.go @@ -71,18 +71,7 @@ Usage: vault auth-enable [options] type General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. + ` + generalOptionsUsage() + ` Auth Enable Options: diff --git a/command/delete.go b/command/delete.go index 09f5332a1c..dd7bfcfad9 100644 --- a/command/delete.go +++ b/command/delete.go @@ -61,19 +61,6 @@ Usage: vault delete [options] path General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. - -` + ` + generalOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/init.go b/command/init.go index 4bcac56664..8f745518d2 100644 --- a/command/init.go +++ b/command/init.go @@ -80,18 +80,7 @@ Usage: vault init [options] General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. + ` + generalOptionsUsage() + ` Init Options: diff --git a/command/key_status.go b/command/key_status.go index bf68c08eac..5a2cf5b003 100644 --- a/command/key_status.go +++ b/command/key_status.go @@ -49,19 +49,6 @@ Usage: vault key-status [options] General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. - -` + ` + generalOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/meta.go b/command/meta.go index 218ad177e5..91141da5c5 100644 --- a/command/meta.go +++ b/command/meta.go @@ -14,6 +14,7 @@ import ( "os" "path/filepath" "strconv" + "strings" "time" "github.com/hashicorp/vault/api" @@ -308,3 +309,29 @@ func (m *Meta) loadCertFromPEM(path string) ([]*x509.Certificate, error) { return certs, nil } + +// generalOptionsUsage returns the usage documenation for commonly +// available options +func generalOptionsUsage() string { + general := ` + -address=addr The address of the Vault server. + + -ca-cert=path Path to a PEM encoded CA cert file to use to + verify the Vault server SSL certificate. + + -ca-path=path Path to a directory of PEM encoded CA cert files + to verify the Vault server SSL certificate. If both + -ca-cert and -ca-path are specified, -ca-path is used. + + -client-cert=path Path to a PEM encoded client certificate for TLS + authentication to the Vault server. Must also specify + -client-key. + + -client-key=path Path to an unencrypted PEM encoded private key + matching the client certificate from -client-cert. + + -tls-skip-verify Do not verify TLS certificate. This is highly + not recommended. + ` + return strings.TrimSpace(general) +} diff --git a/command/mount.go b/command/mount.go index d9abe51346..226e4d7c6a 100644 --- a/command/mount.go +++ b/command/mount.go @@ -70,18 +70,7 @@ Usage: vault mount [options] type General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. + ` + generalOptionsUsage() + ` Mount Options: diff --git a/command/mounts.go b/command/mounts.go index c950d3d348..fcdc1648bf 100644 --- a/command/mounts.go +++ b/command/mounts.go @@ -67,19 +67,6 @@ Usage: vault mounts [options] General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. - -` + ` + generalOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/path_help.go b/command/path_help.go index 792ea9e3a4..7c973c52a8 100644 --- a/command/path_help.go +++ b/command/path_help.go @@ -70,19 +70,6 @@ Usage: vault path-help [options] path General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. - -` + ` + generalOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/policy_delete.go b/command/policy_delete.go index e378302705..daa6963f6f 100644 --- a/command/policy_delete.go +++ b/command/policy_delete.go @@ -59,19 +59,6 @@ Usage: vault policy-delete [options] name General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. - -` + ` + generalOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/policy_list.go b/command/policy_list.go index ff53b5b294..72c3c4db8d 100644 --- a/command/policy_list.go +++ b/command/policy_list.go @@ -86,19 +86,6 @@ Usage: vault policies [options] [name] General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. - -` + ` + generalOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/policy_write.go b/command/policy_write.go index f92ba4874a..95696bb509 100644 --- a/command/policy_write.go +++ b/command/policy_write.go @@ -83,19 +83,6 @@ Usage: vault policy-write [options] name path General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. - -` + ` + generalOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/read.go b/command/read.go index 983ae56bb3..48831c7225 100644 --- a/command/read.go +++ b/command/read.go @@ -84,18 +84,7 @@ Usage: vault read [options] path General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. + ` + generalOptionsUsage() + ` Read Options: diff --git a/command/rekey.go b/command/rekey.go index e2f89d5852..afecfba64a 100644 --- a/command/rekey.go +++ b/command/rekey.go @@ -205,18 +205,7 @@ Usage: vault rekey [options] [key] General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. + ` + generalOptionsUsage() + ` Unseal Options: diff --git a/command/remount.go b/command/remount.go index 786a97dd01..8cf529723f 100644 --- a/command/remount.go +++ b/command/remount.go @@ -67,19 +67,6 @@ Usage: vault remount [options] from to General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. - -` + ` + generalOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/renew.go b/command/renew.go index f3b3d44100..9135f79b7d 100644 --- a/command/renew.go +++ b/command/renew.go @@ -79,18 +79,7 @@ Usage: vault renew [options] id [increment] General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. + ` + generalOptionsUsage() + ` Renew Options: diff --git a/command/revoke.go b/command/revoke.go index 5458f3b376..149cbad84e 100644 --- a/command/revoke.go +++ b/command/revoke.go @@ -69,18 +69,7 @@ Usage: vault revoke [options] id General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. + ` + generalOptionsUsage() + ` Revoke Options: diff --git a/command/rotate.go b/command/rotate.go index f790d15b77..fd2d637183 100644 --- a/command/rotate.go +++ b/command/rotate.go @@ -61,19 +61,6 @@ Usage: vault rotate [options] General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. - -` + ` + generalOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/seal.go b/command/seal.go index 0fb13e548c..41b735c626 100644 --- a/command/seal.go +++ b/command/seal.go @@ -57,19 +57,6 @@ Usage: vault seal [options] General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. - -` + ` + generalOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/status.go b/command/status.go index 1efb31744f..910fde3da7 100644 --- a/command/status.go +++ b/command/status.go @@ -98,19 +98,6 @@ Usage: vault status [options] General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. - -` + ` + generalOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/token_create.go b/command/token_create.go index 21d85d92b5..a53cade67e 100644 --- a/command/token_create.go +++ b/command/token_create.go @@ -88,18 +88,7 @@ Usage: vault token-create [options] General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. + ` + generalOptionsUsage() + ` Token Options: diff --git a/command/token_renew.go b/command/token_renew.go index 98a38ea828..b47f798b54 100644 --- a/command/token_renew.go +++ b/command/token_renew.go @@ -76,18 +76,7 @@ Usage: vault token-renew [options] token [increment] General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. + ` + generalOptionsUsage() + ` Token Renew Options: diff --git a/command/token_revoke.go b/command/token_revoke.go index e63ce257fd..76e6370ee1 100644 --- a/command/token_revoke.go +++ b/command/token_revoke.go @@ -88,18 +88,7 @@ Usage: vault token-revoke [options] token General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. + ` + generalOptionsUsage() + ` Token Options: diff --git a/command/unmount.go b/command/unmount.go index 1a366ea2dd..2fb0ddb12a 100644 --- a/command/unmount.go +++ b/command/unmount.go @@ -61,19 +61,6 @@ Usage: vault unmount [options] type General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. - -` + ` + generalOptionsUsage() return strings.TrimSpace(helpText) } diff --git a/command/unseal.go b/command/unseal.go index 18d486f451..c7eee8c694 100644 --- a/command/unseal.go +++ b/command/unseal.go @@ -112,18 +112,7 @@ Usage: vault unseal [options] [key] General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. + ` + generalOptionsUsage() + ` Unseal Options: diff --git a/command/write.go b/command/write.go index ba0fdd823d..926f22120e 100644 --- a/command/write.go +++ b/command/write.go @@ -107,18 +107,7 @@ Usage: vault write [options] path [data] General Options: - -address=addr The address of the Vault server. - - -ca-cert=path Path to a PEM encoded CA cert file to use to - verify the Vault server SSL certificate. - - -ca-path=path Path to a directory of PEM encoded CA cert files - to verify the Vault server SSL certificate. If both - -ca-cert and -ca-path are specified, -ca-path is used. - - -tls-skip-verify Do not verify TLS certificate. This is highly - not recommended. This is especially not recommended - for unsealing a vault. + ` + generalOptionsUsage() + ` Write Options: