update --sh option
This commit is contained in:
parent
0cc84183c3
commit
89ccb0b208
@ -76,7 +76,16 @@ func secretsFunc(c *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
if c.Bool("sh") {
|
||||
str := `aws secretsmanager list-secrets --query 'SecretList[].[Name,Description]' --output text | sort`
|
||||
tags_str := ""
|
||||
for k, v := range tags {
|
||||
tags_str += fmt.Sprintf("--filters Name=tag:%s,Values=%s ", k, v)
|
||||
}
|
||||
// remove trailing space
|
||||
tags_str = strings.TrimRight(tags_str, " ")
|
||||
str := fmt.Sprintf(
|
||||
"aws secretsmanager list-secrets --query 'SecretList[].[Name,Description]' %s --output text | sort",
|
||||
tags_str,
|
||||
)
|
||||
fmt.Fprintln(os.Stderr, str)
|
||||
}
|
||||
if len(secrets) == 0 {
|
||||
@ -104,7 +113,7 @@ func secretsFunc(c *cli.Context) error {
|
||||
} else {
|
||||
// print the aws cli equivalent command to output this secret to stderr
|
||||
if c.Bool("sh") {
|
||||
fmt.Fprintln(os.Stderr, fmt.Sprintf("aws secretsmanager get-secret-value --secret-id %s --query SecretString --output text --no-cli-pager", secret))
|
||||
fmt.Fprintln(os.Stderr, fmt.Sprintf("aws secretsmanager get-secret-value --secret-id %s --query SecretString --output text", secret))
|
||||
}
|
||||
fmt.Println(secretValue)
|
||||
}
|
||||
@ -135,12 +144,25 @@ func selectSecretDialog(secretList []client.SecretListEntry) (string, error) {
|
||||
options[i] = huh.NewOption[string](strings.TrimSuffix(fmt.Sprintf("%s: %s", secret.Name, secret.Description), ": "), secret.Name)
|
||||
}
|
||||
|
||||
form := huh.NewForm(
|
||||
huh.NewGroup(
|
||||
huh.NewSelect[string]().
|
||||
Title("Select a secret").
|
||||
Options(options...).
|
||||
Value(&secretName),
|
||||
),
|
||||
)
|
||||
err := form.Run()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
/*
|
||||
huh.NewSelect[string]().
|
||||
Title("Select a secret").
|
||||
Options(options...).
|
||||
Value(&secretName).
|
||||
Run()
|
||||
|
||||
*/
|
||||
return secretName, nil
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user