Skip to content

Commit

Permalink
add completion for config get
Browse files Browse the repository at this point in the history
  • Loading branch information
phm07 committed Jun 5, 2024
1 parent f369c34 commit a61a856
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/cmd/config/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/spf13/cobra"

"github.com/hetznercloud/cli/internal/cmd/cmpl"
"github.com/hetznercloud/cli/internal/cmd/util"
"github.com/hetznercloud/cli/internal/state"
"github.com/hetznercloud/cli/internal/state/config"
Expand All @@ -20,6 +21,15 @@ func NewGetCommand(s state.State) *cobra.Command {
DisableFlagsInUseLine: true,
SilenceUsage: true,
RunE: state.Wrap(s, runGet),
ValidArgsFunction: cmpl.NoFileCompletion(
cmpl.SuggestCandidatesF(func() []string {
var keys []string
for key := range config.Options {
keys = append(keys, key)
}
return keys
}),
),
}
cmd.Flags().Bool("global", false, "Get the value globally")
cmd.Flags().Bool("allow-sensitive", false, "Allow showing sensitive values")
Expand Down

0 comments on commit a61a856

Please sign in to comment.