Skip to content

Commit 2ca765d

Browse files
authored
flip hide-password to show-password (#285)
1 parent fd2aabe commit 2ca765d

File tree

18 files changed

+115
-65
lines changed

18 files changed

+115
-65
lines changed

docs/stackit_argus_grafana_describe.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Shows details of the Grafana configuration of an Argus instance
66

77
Shows details of the Grafana configuration of an Argus instance.
88
The Grafana dashboard URL and initial credentials (admin user and password) will be shown in the "pretty" output format. These credentials are only valid for first login. Please change the password after first login. After changing, the initial password is no longer valid.
9-
The initial password is shown by default, if you want to hide it use the "--hide-password" flag.
9+
The initial password is hidden by default, if you want to show it use the "--show-password" flag.
1010

1111
```
1212
stackit argus grafana describe INSTANCE_ID [flags]
@@ -21,15 +21,15 @@ stackit argus grafana describe INSTANCE_ID [flags]
2121
Get details of the Grafana configuration of an Argus instance with ID "xxx" in a table format
2222
$ stackit argus credentials describe xxx --output-format pretty
2323
24-
Get details of the Grafana configuration of an Argus instance with ID "xxx" and hide the initial admin password
25-
$ stackit argus credentials describe xxx --output-format pretty --hide-password
24+
Get details of the Grafana configuration of an Argus instance with ID "xxx" and show the initial admin password
25+
$ stackit argus credentials describe xxx --output-format pretty --show-password
2626
```
2727

2828
### Options
2929

3030
```
3131
-h, --help Help for "stackit argus grafana describe"
32-
--hide-password Show the initial admin password in the "pretty" output format
32+
--show-password Show the initial admin password in the "pretty" output format
3333
```
3434

3535
### Options inherited from parent commands

docs/stackit_logme_credentials_create.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ stackit logme credentials create [flags]
1616
Create credentials for a LogMe instance
1717
$ stackit logme credentials create --instance-id xxx
1818
19-
Create credentials for a LogMe instance and hide the password in the output
20-
$ stackit logme credentials create --instance-id xxx --hide-password
19+
Create credentials for a LogMe instance and show the password in the output
20+
$ stackit logme credentials create --instance-id xxx --show-password
2121
```
2222

2323
### Options
2424

2525
```
2626
-h, --help Help for "stackit logme credentials create"
27-
--hide-password Hide password in output
2827
--instance-id string Instance ID
28+
--show-password Show password in output
2929
```
3030

3131
### Options inherited from parent commands

docs/stackit_mariadb_credentials_create.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ stackit mariadb credentials create [flags]
1616
Create credentials for a MariaDB instance
1717
$ stackit mariadb credentials create --instance-id xxx
1818
19-
Create credentials for a MariaDB instance and hide the password in the output
20-
$ stackit mariadb credentials create --instance-id xxx --hide-password
19+
Create credentials for a MariaDB instance and show the password in the output
20+
$ stackit mariadb credentials create --instance-id xxx --show-password
2121
```
2222

2323
### Options
2424

2525
```
2626
-h, --help Help for "stackit mariadb credentials create"
27-
--hide-password Hide password in output
2827
--instance-id string Instance ID
28+
--show-password Show password in output
2929
```
3030

3131
### Options inherited from parent commands

docs/stackit_opensearch_credentials_create.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ stackit opensearch credentials create [flags]
1616
Create credentials for an OpenSearch instance
1717
$ stackit opensearch credentials create --instance-id xxx
1818
19-
Create credentials for an OpenSearch instance and hide the password in the output
20-
$ stackit opensearch credentials create --instance-id xxx --hide-password
19+
Create credentials for an OpenSearch instance and show the password in the output
20+
$ stackit opensearch credentials create --instance-id xxx --show-password
2121
```
2222

2323
### Options
2424

2525
```
2626
-h, --help Help for "stackit opensearch credentials create"
27-
--hide-password Hide password in output
2827
--instance-id string Instance ID
28+
--show-password Show password in output
2929
```
3030

3131
### Options inherited from parent commands

docs/stackit_rabbitmq_credentials_create.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ stackit rabbitmq credentials create [flags]
1616
Create credentials for a RabbitMQ instance
1717
$ stackit rabbitmq credentials create --instance-id xxx
1818
19-
Create credentials for a RabbitMQ instance and hide the password in the output
20-
$ stackit rabbitmq credentials create --instance-id xxx --hide-password
19+
Create credentials for a RabbitMQ instance and show the password in the output
20+
$ stackit rabbitmq credentials create --instance-id xxx --show-password
2121
```
2222

2323
### Options
2424

2525
```
2626
-h, --help Help for "stackit rabbitmq credentials create"
27-
--hide-password Hide password in output
2827
--instance-id string Instance ID
28+
--show-password Show password in output
2929
```
3030

3131
### Options inherited from parent commands

docs/stackit_redis_credentials_create.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ stackit redis credentials create [flags]
1616
Create credentials for a Redis instance
1717
$ stackit redis credentials create --instance-id xxx
1818
19-
Create credentials for a Redis instance and hide the password in the output
20-
$ stackit redis credentials create --instance-id xxx --hide-password
19+
Create credentials for a Redis instance and show the password in the output
20+
$ stackit redis credentials create --instance-id xxx --show-password
2121
```
2222

2323
### Options
2424

2525
```
2626
-h, --help Help for "stackit redis credentials create"
27-
--hide-password Hide password in output
2827
--instance-id string Instance ID
28+
--show-password Show password in output
2929
```
3030

3131
### Options inherited from parent commands

internal/cmd/argus/grafana/describe/describe.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import (
2121

2222
const (
2323
instanceIdArg = "INSTANCE_ID"
24-
hidePasswordFlag = "hide-password"
24+
showPasswordFlag = "show-password"
2525
)
2626

2727
type inputModel struct {
2828
*globalflags.GlobalFlagModel
2929
InstanceId string
30-
HidePassword bool
30+
ShowPassword bool
3131
}
3232

3333
func NewCmd(p *print.Printer) *cobra.Command {
@@ -37,7 +37,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
3737
Long: fmt.Sprintf("%s\n%s\n%s",
3838
"Shows details of the Grafana configuration of an Argus instance.",
3939
`The Grafana dashboard URL and initial credentials (admin user and password) will be shown in the "pretty" output format. These credentials are only valid for first login. Please change the password after first login. After changing, the initial password is no longer valid.`,
40-
`The initial password is shown by default, if you want to hide it use the "--hide-password" flag.`,
40+
`The initial password is hidden by default, if you want to show it use the "--show-password" flag.`,
4141
),
4242
Args: args.SingleArg(instanceIdArg, utils.ValidateUUID),
4343
Example: examples.Build(
@@ -48,8 +48,8 @@ func NewCmd(p *print.Printer) *cobra.Command {
4848
`Get details of the Grafana configuration of an Argus instance with ID "xxx" in a table format`,
4949
"$ stackit argus credentials describe xxx --output-format pretty"),
5050
examples.NewExample(
51-
`Get details of the Grafana configuration of an Argus instance with ID "xxx" and hide the initial admin password`,
52-
"$ stackit argus credentials describe xxx --output-format pretty --hide-password"),
51+
`Get details of the Grafana configuration of an Argus instance with ID "xxx" and show the initial admin password`,
52+
"$ stackit argus credentials describe xxx --output-format pretty --show-password"),
5353
),
5454
RunE: func(cmd *cobra.Command, args []string) error {
5555
ctx := context.Background()
@@ -84,7 +84,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
8484
}
8585

8686
func configureFlags(cmd *cobra.Command) {
87-
cmd.Flags().Bool(hidePasswordFlag, false, `Show the initial admin password in the "pretty" output format`)
87+
cmd.Flags().Bool(showPasswordFlag, false, `Show the initial admin password in the "pretty" output format`)
8888
}
8989

9090
func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inputModel, error) {
@@ -98,7 +98,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command, inputArgs []string) (*inpu
9898
model := inputModel{
9999
GlobalFlagModel: globalFlags,
100100
InstanceId: instanceId,
101-
HidePassword: flags.FlagToBoolValue(p, cmd, hidePasswordFlag),
101+
ShowPassword: flags.FlagToBoolValue(p, cmd, showPasswordFlag),
102102
}
103103

104104
if p.IsVerbosityDebug() {
@@ -127,7 +127,7 @@ func outputResult(p *print.Printer, inputModel *inputModel, grafanaConfigs *argu
127127
switch inputModel.OutputFormat {
128128
case print.PrettyOutputFormat:
129129
initialAdminPassword := *instance.Instance.GrafanaAdminPassword
130-
if inputModel.HidePassword {
130+
if !inputModel.ShowPassword {
131131
initialAdminPassword = "<hidden>"
132132
}
133133

internal/cmd/argus/grafana/describe/describe_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ func TestParseInput(t *testing.T) {
9494
isValid: false,
9595
},
9696
{
97-
description: "hide password",
97+
description: "show password",
9898
argValues: fixtureArgValues(),
9999
flagValues: fixtureFlagValues(func(flagValues map[string]string) {
100-
flagValues[hidePasswordFlag] = "true"
100+
flagValues[showPasswordFlag] = "true"
101101
}),
102102
isValid: true,
103103
expectedModel: fixtureInputModel(func(model *inputModel) {
104-
model.HidePassword = true
104+
model.ShowPassword = true
105105
}),
106106
},
107107
{

internal/cmd/logme/credentials/create/create.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ import (
2020

2121
const (
2222
instanceIdFlag = "instance-id"
23-
hidePasswordFlag = "hide-password"
23+
showPasswordFlag = "show-password"
2424
)
2525

2626
type inputModel struct {
2727
*globalflags.GlobalFlagModel
2828
InstanceId string
29-
HidePassword bool
29+
ShowPassword bool
3030
}
3131

3232
func NewCmd(p *print.Printer) *cobra.Command {
@@ -40,8 +40,8 @@ func NewCmd(p *print.Printer) *cobra.Command {
4040
`Create credentials for a LogMe instance`,
4141
"$ stackit logme credentials create --instance-id xxx"),
4242
examples.NewExample(
43-
`Create credentials for a LogMe instance and hide the password in the output`,
44-
"$ stackit logme credentials create --instance-id xxx --hide-password"),
43+
`Create credentials for a LogMe instance and show the password in the output`,
44+
"$ stackit logme credentials create --instance-id xxx --show-password"),
4545
),
4646
RunE: func(cmd *cobra.Command, args []string) error {
4747
ctx := context.Background()
@@ -86,7 +86,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
8686

8787
func configureFlags(cmd *cobra.Command) {
8888
cmd.Flags().Var(flags.UUIDFlag(), instanceIdFlag, "Instance ID")
89-
cmd.Flags().Bool(hidePasswordFlag, false, "Hide password in output")
89+
cmd.Flags().Bool(showPasswordFlag, false, "Show password in output")
9090

9191
err := flags.MarkFlagsRequired(cmd, instanceIdFlag)
9292
cobra.CheckErr(err)
@@ -101,7 +101,7 @@ func parseInput(p *print.Printer, cmd *cobra.Command) (*inputModel, error) {
101101
model := inputModel{
102102
GlobalFlagModel: globalFlags,
103103
InstanceId: flags.FlagToStringValue(p, cmd, instanceIdFlag),
104-
HidePassword: flags.FlagToBoolValue(p, cmd, hidePasswordFlag),
104+
ShowPassword: flags.FlagToBoolValue(p, cmd, showPasswordFlag),
105105
}
106106

107107
if p.IsVerbosityDebug() {
@@ -138,7 +138,7 @@ func outputResult(p *print.Printer, model *inputModel, instanceLabel string, res
138138
if username != "" {
139139
p.Outputf("Username: %s\n", *resp.Raw.Credentials.Username)
140140
}
141-
if model.HidePassword {
141+
if !model.ShowPassword {
142142
p.Outputf("Password: <hidden>\n")
143143
} else {
144144
p.Outputf("Password: %s\n", *resp.Raw.Credentials.Password)

internal/cmd/logme/credentials/create/create_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ func TestParseInput(t *testing.T) {
7373
flagValues: map[string]string{},
7474
isValid: false,
7575
},
76+
{
77+
description: "show password",
78+
flagValues: fixtureFlagValues(func(flagValues map[string]string) {
79+
flagValues[showPasswordFlag] = "true"
80+
}),
81+
isValid: true,
82+
expectedModel: fixtureInputModel(func(model *inputModel) {
83+
model.ShowPassword = true
84+
}),
85+
},
7686
{
7787
description: "project id missing",
7888
flagValues: fixtureFlagValues(func(flagValues map[string]string) {

0 commit comments

Comments
 (0)