Browse code

CLI usability - proposed aliases

Fabiano Franz authored on 2015/11/04 05:23:41
Showing 9 changed files
... ...
@@ -1759,9 +1759,9 @@ _oc_env()
1759 1759
     must_have_one_noun=()
1760 1760
 }
1761 1761
 
1762
-_oc_volume()
1762
+_oc_volumes()
1763 1763
 {
1764
-    last_command="oc_volume"
1764
+    last_command="oc_volumes"
1765 1765
     commands=()
1766 1766
 
1767 1767
     flags=()
... ...
@@ -5358,7 +5358,7 @@ _oc()
5358 5358
     commands+=("describe")
5359 5359
     commands+=("edit")
5360 5360
     commands+=("env")
5361
-    commands+=("volume")
5361
+    commands+=("volumes")
5362 5362
     commands+=("label")
5363 5363
     commands+=("annotate")
5364 5364
     commands+=("expose")
... ...
@@ -6486,9 +6486,9 @@ _openshift_cli_env()
6486 6486
     must_have_one_noun=()
6487 6487
 }
6488 6488
 
6489
-_openshift_cli_volume()
6489
+_openshift_cli_volumes()
6490 6490
 {
6491
-    last_command="openshift_cli_volume"
6491
+    last_command="openshift_cli_volumes"
6492 6492
     commands=()
6493 6493
 
6494 6494
     flags=()
... ...
@@ -10085,7 +10085,7 @@ _openshift_cli()
10085 10085
     commands+=("describe")
10086 10086
     commands+=("edit")
10087 10087
     commands+=("env")
10088
-    commands+=("volume")
10088
+    commands+=("volumes")
10089 10089
     commands+=("label")
10090 10090
     commands+=("annotate")
10091 10091
     commands+=("expose")
... ...
@@ -1031,7 +1031,7 @@ An introduction to concepts and types
1031 1031
 ====
1032 1032
 
1033 1033
 
1034
-== oc volume
1034
+== oc volumes
1035 1035
 Update volume on a resource with a pod template
1036 1036
 
1037 1037
 ====
... ...
@@ -67,6 +67,7 @@ func NewCmdProject(fullName string, f *clientcmd.Factory, out io.Writer) *cobra.
67 67
 		Short:   "Switch to another project",
68 68
 		Long:    projectLong,
69 69
 		Example: fmt.Sprintf(projectExample, fullName),
70
+		Aliases: []string{"projects"},
70 71
 		Run: func(cmd *cobra.Command, args []string) {
71 72
 			options.PathOptions = cliconfig.NewPathOptions(cmd)
72 73
 
... ...
@@ -137,10 +137,11 @@ func NewCmdVolume(fullName string, f *clientcmd.Factory, out, errOut io.Writer)
137 137
 	addOpts := &AddVolumeOptions{}
138 138
 	opts := &VolumeOptions{AddOpts: addOpts}
139 139
 	cmd := &cobra.Command{
140
-		Use:     "volume RESOURCE/NAME --add|--remove|--list",
140
+		Use:     "volumes RESOURCE/NAME --add|--remove|--list",
141 141
 		Short:   "Update volume on a resource with a pod template",
142 142
 		Long:    volumeLong,
143 143
 		Example: fmt.Sprintf(volumeExample, fullName),
144
+		Aliases: []string{"volume"},
144 145
 		Run: func(cmd *cobra.Command, args []string) {
145 146
 			addOpts.TypeChanged = cmd.Flag("type").Changed
146 147
 
... ...
@@ -37,10 +37,11 @@ Docker registries.`
37 37
 func NewCmdSecrets(name, fullName string, f *clientcmd.Factory, reader io.Reader, out io.Writer, ocEditFullName string) *cobra.Command {
38 38
 	// Parent command to which all subcommands are added.
39 39
 	cmds := &cobra.Command{
40
-		Use:   name,
41
-		Short: "Manage secrets",
42
-		Long:  secretsLong,
43
-		Run:   cmdutil.DefaultSubCommandRun(out),
40
+		Use:     name,
41
+		Short:   "Manage secrets",
42
+		Long:    secretsLong,
43
+		Aliases: []string{"secret"},
44
+		Run:     cmdutil.DefaultSubCommandRun(out),
44 45
 	}
45 46
 
46 47
 	newSecretFullName := fullName + " " + NewSecretRecommendedCommandName
... ...
@@ -88,6 +88,10 @@ os::cmd::expect_success_and_text 'openshift kubectl get --help' 'Display one or
88 88
 os::cmd::expect_success_and_text 'openshift start --help' 'Start an all-in-one server'
89 89
 os::cmd::expect_success_and_text 'openshift start master --help' 'Start a master'
90 90
 os::cmd::expect_success_and_text 'openshift start node --help' 'Start a node'
91
+os::cmd::expect_success_and_text 'oc project --help' 'Switch to another project'
92
+os::cmd::expect_success_and_text 'oc projects --help' 'Switch to another project'
93
+os::cmd::expect_success_and_text 'openshift cli project --help' 'Switch to another project'
94
+os::cmd::expect_success_and_text 'openshift cli projects --help' 'Switch to another project'
91 95
 os::cmd::expect_success_and_text 'oc get --help' 'oc'
92 96
 
93 97
 # help for given command through help command must be consistent
... ...
@@ -97,10 +101,14 @@ os::cmd::expect_success_and_text 'openshift help kubectl get' 'Display one or ma
97 97
 os::cmd::expect_success_and_text 'openshift help start' 'Start an all-in-one server'
98 98
 os::cmd::expect_success_and_text 'openshift help start master' 'Start a master'
99 99
 os::cmd::expect_success_and_text 'openshift help start node' 'Start a node'
100
+os::cmd::expect_success_and_text 'oc help project' 'Switch to another project'
101
+os::cmd::expect_success_and_text 'oc help projects' 'Switch to another project'
100 102
 # TODO: fix these tests
101 103
 # os::cmd::expect_success_and_text 'openshift cli help update' 'Update a resource'
102 104
 # os::cmd::expect_success_and_text 'openshift cli help replace' 'Replace a resource'
103 105
 # os::cmd::expect_success_and_text 'openshift cli help patch' 'Update field\(s\) of a resource'
106
+# os::cmd::expect_success_and_text 'openshift cli help project' 'Switch to another project'
107
+# os::cmd::expect_success_and_text 'openshift cli help projects' 'Switch to another project'
104 108
 
105 109
 # runnable commands with required flags must error consistently
106 110
 os::cmd::expect_failure_and_text 'oc get' 'Required resource not specified'
... ...
@@ -60,4 +60,12 @@ os::cmd::expect_success 'oc secrets add serviceaccounts/deployer secrets/basicau
60 60
 # make sure we can add as as pull secret and mount secret at once
61 61
 os::cmd::expect_success 'oc secrets add serviceaccounts/deployer secrets/basicauth secrets/sshauth --for=pull,mount'
62 62
 
63
+# command alias
64
+os::cmd::expect_success 'oc secret --help'
65
+os::cmd::expect_success 'oc secret new --help'
66
+os::cmd::expect_success 'oc secret new-dockercfg --help'
67
+os::cmd::expect_success 'oc secret new-basicauth --help'
68
+os::cmd::expect_success 'oc secret new-sshauth --help'
69
+os::cmd::expect_success 'oc secret add --help'
70
+
63 71
 echo "secrets: ok"
... ...
@@ -35,5 +35,9 @@ os::cmd::expect_success 'oc volume dc/test-deployment-config --add --mount-path=
35 35
 os::cmd::expect_success 'oc volume dc/test-deployment-config --add --mount-path=/second --type=pvc --claim-size=1G --claim-mode=rwo'
36 36
 os::cmd::expect_success_and_text 'oc get pvc --no-headers | wc -l' '2'
37 37
 
38
+# command alias
39
+os::cmd::expect_success 'oc volumes --help'
40
+os::cmd::expect_success 'oc volumes dc/test-deployment-config --list'
41
+
38 42
 os::cmd::expect_success 'oc delete dc/test-deployment-config'
39 43
 echo "volumes: ok"
40 44
\ No newline at end of file