Skip to content

Commit e0cfea0

Browse files
authored
chore: be consistent with long option syntax in examples and tests (#486)
Write them without equal signs where appropriate, to match cobra's auto generated help output.
1 parent ca7d84a commit e0cfea0

4 files changed

Lines changed: 51 additions & 51 deletions

File tree

internal/commands/database/create.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ func CreateCommand() commands.Command {
3030
"create",
3131
"Create a new database",
3232
`upctl database create \
33-
--title=mydb \
34-
--zone=fi-hel1 \
35-
--hostname-prefix=mydb`,
33+
--title mydb \
34+
--zone fi-hel1 \
35+
--hostname-prefix mydb`,
3636
`upctl database create \
37-
--title=mydb \
38-
--zone=fi-hel1 \
39-
--type=pg \
40-
--hostname-prefix=mydb \
37+
--title mydb \
38+
--zone fi-hel1 \
39+
--type pg \
40+
--hostname-prefix mydb \
4141
--termination-protection \
4242
--label env=dev \
4343
--property max_connections=200`,

internal/commands/database/create_test.go

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ func TestCreateCommand(t *testing.T) {
3838
{
3939
name: "minimum required parameters",
4040
args: []string{
41-
"--title=db-test",
42-
"--zone=fi-hel1",
43-
"--hostname-prefix=testdb",
41+
"--title", "db-test",
42+
"--zone", "fi-hel1",
43+
"--hostname-prefix", "testdb",
4444
},
4545
createDatabaseReq: request.CreateManagedDatabaseRequest{
4646
Title: "db-test",
@@ -53,14 +53,14 @@ func TestCreateCommand(t *testing.T) {
5353
{
5454
name: "pg with label, protection, and version parameters",
5555
args: []string{
56-
"--title=full-test",
57-
"--zone=fi-hel1",
58-
"--hostname-prefix=fulldb",
59-
"--plan=4x4xCPU-8GB-200GB",
60-
"--type=pg",
61-
"--label=env=test,app=database",
56+
"--title", "full-test",
57+
"--zone", "fi-hel1",
58+
"--hostname-prefix", "fulldb",
59+
"--plan", "4x4xCPU-8GB-200GB",
60+
"--type", "pg",
61+
"--label", "env=test,app=database",
6262
"--enable-termination-protection",
63-
"--property=version=13",
63+
"--property", "version=13",
6464
},
6565
createDatabaseReq: request.CreateManagedDatabaseRequest{
6666
Title: "full-test",
@@ -78,16 +78,16 @@ func TestCreateCommand(t *testing.T) {
7878
{
7979
name: "opensearch with properties parameters",
8080
args: []string{
81-
"--title=full-test",
82-
"--zone=fi-hel1",
83-
"--hostname-prefix=fulldb",
84-
"--plan=4x4xCPU-8GB-200GB",
85-
"--type=opensearch",
86-
"--property=saml={\"enabled\":true}", // without quotes
87-
"--property=openid=\"{\"client_id\":\"test_client_id\"}\"", // with quotes
88-
"--property=ism_enabled=true",
89-
"--property=custom_domain=custom.upcloud.com",
90-
"--property=numeric_string=123",
81+
"--title", "full-test",
82+
"--zone", "fi-hel1",
83+
"--hostname-prefix", "fulldb",
84+
"--plan", "4x4xCPU-8GB-200GB",
85+
"--type", "opensearch",
86+
"--property", "saml={\"enabled\":true}", // without quotes
87+
"--property", "openid=\"{\"client_id\":\"test_client_id\"}\"", // with quotes
88+
"--property", "ism_enabled=true",
89+
"--property", "custom_domain=custom.upcloud.com",
90+
"--property", "numeric_string=123",
9191
},
9292
createDatabaseReq: request.CreateManagedDatabaseRequest{
9393
Title: "full-test",
@@ -107,9 +107,9 @@ func TestCreateCommand(t *testing.T) {
107107
{
108108
name: "mysql default database type",
109109
args: []string{
110-
"--title=mysql-test",
111-
"--zone=fi-hel1",
112-
"--hostname-prefix=mysqldb",
110+
"--title", "mysql-test",
111+
"--zone", "fi-hel1",
112+
"--hostname-prefix", "mysqldb",
113113
},
114114
createDatabaseReq: request.CreateManagedDatabaseRequest{
115115
Title: "mysql-test",
@@ -122,11 +122,11 @@ func TestCreateCommand(t *testing.T) {
122122
{
123123
name: "maintenance-dow and maintenance-time",
124124
args: []string{
125-
"--title=mysql-test",
126-
"--zone=fi-hel1",
127-
"--hostname-prefix=mysqldb",
128-
"--maintenance-dow=monday",
129-
"--maintenance-time=02:00",
125+
"--title", "mysql-test",
126+
"--zone", "fi-hel1",
127+
"--hostname-prefix", "mysqldb",
128+
"--maintenance-dow", "monday",
129+
"--maintenance-time", "02:00",
130130
},
131131
createDatabaseReq: request.CreateManagedDatabaseRequest{
132132
Title: "mysql-test",
@@ -143,24 +143,24 @@ func TestCreateCommand(t *testing.T) {
143143
{
144144
name: "missing required title parameter",
145145
args: []string{
146-
"--zone=fi-hel1",
147-
"--hostname-prefix=testdb",
146+
"--zone", "fi-hel1",
147+
"--hostname-prefix", "testdb",
148148
},
149149
error: "required flag(s) \"title\" not set",
150150
},
151151
{
152152
name: "missing required zone parameter",
153153
args: []string{
154-
"--title=db-test",
155-
"--hostname-prefix=testdb",
154+
"--title", "db-test",
155+
"--hostname-prefix", "testdb",
156156
},
157157
error: "required flag(s) \"zone\" not set",
158158
},
159159
{
160160
name: "missing required hostname-prefix parameter",
161161
args: []string{
162-
"--title=db-test",
163-
"--zone=fi-hel1",
162+
"--title", "db-test",
163+
"--zone", "fi-hel1",
164164
},
165165
error: "required flag(s) \"hostname-prefix\" not set",
166166
},

internal/commands/kubernetes/nodegroup/create_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ func TestCreateKubernetesNodeGroup(t *testing.T) {
7474
args: []string{
7575
clusterUUID,
7676
"--count", "2",
77-
"--kubelet-arg=log-flush-frequency=5s",
78-
"--label=owner=devteam",
79-
"--label=env=dev",
80-
"--name=my-node-group",
81-
"--plan=2xCPU-4GB",
82-
"--ssh-key=ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMWq/xsiYPgA/HLsaWHcjAGnwU+pJy9BUmvIlMBpkdn2 admin@user.com",
83-
"--storage=01000000-0000-4000-8000-000160010100",
84-
"--taint=env=dev:NoSchedule",
85-
"--taint=env=dev2:NoSchedule",
77+
"--kubelet-arg", "log-flush-frequency=5s",
78+
"--label", "owner=devteam",
79+
"--label", "env=dev",
80+
"--name", "my-node-group",
81+
"--plan", "2xCPU-4GB",
82+
"--ssh-key", "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMWq/xsiYPgA/HLsaWHcjAGnwU+pJy9BUmvIlMBpkdn2 admin@user.com",
83+
"--storage", "01000000-0000-4000-8000-000160010100",
84+
"--taint", "env=dev:NoSchedule",
85+
"--taint", "env=dev2:NoSchedule",
8686
"--disable-utility-network-access",
8787
},
8888
expected: request.CreateKubernetesNodeGroupRequest{

internal/commands/kubernetes/nodegroup/scale_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestScaleKubernetesNodeGroup(t *testing.T) {
3333
args: []string{
3434
clusterUUID,
3535
"--name", "my-node-group",
36-
"--count=6",
36+
"--count", "6",
3737
},
3838
expected: request.ModifyKubernetesNodeGroupRequest{
3939
ClusterUUID: clusterUUID,

0 commit comments

Comments
 (0)