Add pluralized aliases to config get commands

This changes the `get-credentials` command to `get-credential` to be
uniform with the other config commads. It then adds pluralized aliases
to `get-credential`, `get-cluster`, and `get-context`

Change-Id: Icb5a308f591589f5b68a8ad1c172c3b99ef3a4f1
This commit is contained in:
Ian Howell 2020-05-06 14:35:29 -05:00
parent d126615f8b
commit f1591bc347
7 changed files with 22 additions and 10 deletions

View File

@ -36,7 +36,7 @@ credentials if no name is provided.
airshipctl config get-credentials
# Display a specific user's credentials
airshipctl config get-credentials exampleUser
airshipctl config get-credential exampleUser
`
)
@ -45,10 +45,11 @@ airshipctl config get-credentials exampleUser
func NewGetAuthInfoCommand(rootSettings *environment.AirshipCTLSettings) *cobra.Command {
o := &config.AuthInfoOptions{}
cmd := &cobra.Command{
Use: "get-credentials [NAME]",
Use: "get-credential [NAME]",
Short: "Get user credentials from the airshipctl config",
Long: getAuthInfoLong[1:],
Example: getAuthInfoExample,
Aliases: []string{"get-credentials"},
Args: cobra.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
airconfig := rootSettings.Config

View File

@ -36,7 +36,7 @@ Valid values for the --cluster-type flag are [ephemeral|target].
getClusterExample = `
# List all clusters
airshipctl config get-cluster
airshipctl config get-clusters
# Display a specific cluster
airshipctl config get-cluster --cluster-type=ephemeral exampleCluster
@ -52,6 +52,7 @@ func NewGetClusterCommand(rootSettings *environment.AirshipCTLSettings) *cobra.C
Short: "Get cluster information from the airshipctl config",
Long: getClusterLong[1:],
Example: getClusterExample,
Aliases: []string{"get-clusters"},
RunE: func(cmd *cobra.Command, args []string) error {
airconfig := rootSettings.Config
if len(args) == 1 {

View File

@ -32,7 +32,7 @@ Display information about contexts such as associated manifests, users, and clus
getContextExample = `
# List all contexts
airshipctl config get-context
airshipctl config get-contexts
# Display the current context
airshipctl config get-context --current
@ -51,6 +51,7 @@ func NewGetContextCommand(rootSettings *environment.AirshipCTLSettings) *cobra.C
Short: "Get context information from the airshipctl config",
Long: getContextLong[1:],
Example: getContextExample,
Aliases: []string{"get-contexts"},
RunE: func(cmd *cobra.Command, args []string) error {
airconfig := rootSettings.Config
if len(args) == 1 {

View File

@ -6,7 +6,7 @@ Usage:
Available Commands:
get-cluster Get cluster information from the airshipctl config
get-context Get context information from the airshipctl config
get-credentials Get user credentials from the airshipctl config
get-credential Get user credentials from the airshipctl config
help Help about any command
import Merge information from a kubernetes config file
init Generate initial configuration files for airshipctl

View File

@ -1,6 +1,9 @@
Error: Missing configuration: User credentials with name 'authinfoMissing'
Usage:
get-credentials [NAME] [flags]
get-credential [NAME] [flags]
Aliases:
get-credential, get-credentials
Examples:
@ -8,9 +11,9 @@ Examples:
airshipctl config get-credentials
# Display a specific user's credentials
airshipctl config get-credentials exampleUser
airshipctl config get-credential exampleUser
Flags:
-h, --help help for get-credentials
-h, --help help for get-credential

View File

@ -2,10 +2,13 @@ Error: Missing configuration: Cluster with name 'clusterMissing' of type 'target
Usage:
get-cluster [NAME] [flags]
Aliases:
get-cluster, get-clusters
Examples:
# List all clusters
airshipctl config get-cluster
airshipctl config get-clusters
# Display a specific cluster
airshipctl config get-cluster --cluster-type=ephemeral exampleCluster

View File

@ -2,10 +2,13 @@ Error: Missing configuration: Context with name 'contextMissing'
Usage:
get-context [NAME] [flags]
Aliases:
get-context, get-contexts
Examples:
# List all contexts
airshipctl config get-context
airshipctl config get-contexts
# Display the current context
airshipctl config get-context --current