Skip to content

Commit

Permalink
fix(cli): correct help text
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis-yeung authored and JanDeDobbeleer committed Nov 5, 2024
1 parent 2c982b2 commit 472bd6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
5 changes: 2 additions & 3 deletions src/cli/disable.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ package cli

import (
"fmt"
"strings"

"github.com/spf13/cobra"
)

// getCmd represents the get command
var disableCmd = &cobra.Command{
Use: fmt.Sprintf(toggleUse, "disable", strings.Join(toggleArgs, "|")),
Use: fmt.Sprintf(toggleUse, "disable"),
Short: "Disable a feature",
Long: fmt.Sprintf(toggleLong, "Disable", "disable"),
Long: fmt.Sprintf(toggleLong, "Disable"),
ValidArgs: toggleArgs,
Args: NoArgsOrOneValidArg,
Run: func(cmd *cobra.Command, args []string) {
Expand Down
14 changes: 6 additions & 8 deletions src/cli/enable.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,21 @@ import (
)

var (
toggleUse = "%s [%s]"
toggleLong = `%s a feature
This command is used to %s one of the following features:
- upgradenotice`
toggleHelpText = `%s one of the following features:
`
toggleArgs = []string{
config.UPGRADENOTICE,
config.AUTOUPGRADE,
}
toggleUse = fmt.Sprintf("%%s [%s]", strings.Join(toggleArgs, "|"))
toggleLong = strings.Join(append([]string{toggleHelpText}, toggleArgs...), "\n- ")
)

// getCmd represents the get command
var enableCmd = &cobra.Command{
Use: fmt.Sprintf(toggleUse, "enable", strings.Join(toggleArgs, "|")),
Use: fmt.Sprintf(toggleUse, "enable"),
Short: "Enable a feature",
Long: fmt.Sprintf(toggleLong, "Enable", "enable"),
Long: fmt.Sprintf(toggleLong, "Enable"),
ValidArgs: toggleArgs,
Args: NoArgsOrOneValidArg,
Run: func(cmd *cobra.Command, args []string) {
Expand Down

0 comments on commit 472bd6f

Please sign in to comment.