Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
  • Loading branch information
qweeah committed Apr 11, 2023
1 parent 5e78115 commit 8929b44
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/experimental/experimental.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ func CheckCommandAndWarn(cmd *cobra.Command, args []string) error {
func FlagsChecker(flags ...string) func(cmd *cobra.Command, args []string) error {
return func(cmd *cobra.Command, args []string) error {
if err := Check(func() (string, bool) {
var changed []string
var changedFlags []string
flagSet := cmd.Flags()
for _, flag := range flags {
fs := cmd.Flags()
fs.MarkHidden(flag)
if fs.Changed(flag) {
changed = append(changed, "--"+flag)
flagSet.MarkHidden(flag)
if flagSet.Changed(flag) {
changedFlags = append(changedFlags, "--"+flag)
}
}
if len(changed) == 0 {
if len(changedFlags) == 0 {
// no experimental flag used
return "", false
}
return fmt.Sprintf("using %q in %q", strings.Join(changed, ","), cmd.CommandPath()), true
return fmt.Sprintf("using flags %q in %q", strings.Join(changedFlags, ","), cmd.CommandPath()), true
}); err != nil {
return err
}
Expand Down

0 comments on commit 8929b44

Please sign in to comment.