Skip to content

Commit ffbf184

Browse files
committed
fix: CLI from expecting secret name when listing secrets
CLI expects secret name when trying to list all secrets in a namespace
1 parent 45159e7 commit ffbf184

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cmd/vclusterctl/cmd/platform/get/secret.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,23 @@ vcluster platform get secret test-secret.key
5454
vcluster platform get secret test-secret.key --project myproject
5555
########################################################
5656
`)
57+
5758
useLine, validator := util.NamedPositionalArgsValidator(true, true, "SECRET_NAME")
5859
c := &cobra.Command{
5960
Use: "secret" + useLine,
6061
Short: "Returns the key value of a project / shared secret",
6162
Long: description,
62-
Args: validator,
63+
Args: func(cmd *cobra.Command, args []string) error {
64+
// bypass validation if the "all" flag is set
65+
all, err := cmd.Flags().GetBool("all")
66+
if err != nil {
67+
return err
68+
}
69+
if !all {
70+
return validator(cmd, args)
71+
}
72+
return nil
73+
},
6374
RunE: func(cobraCmd *cobra.Command, args []string) error {
6475
return cmd.Run(cobraCmd.Context(), args)
6576
},

0 commit comments

Comments
 (0)