refactor(cobra): small refactor

This commit is contained in:
Sasha Melentyev 2021-12-24 05:21:08 +03:00
parent cb9d7b1cec
commit c969c6c796
4 changed files with 6 additions and 6 deletions

View file

@ -52,7 +52,7 @@ func OnlyValidArgs(cmd *Command, args []string) error {
}
// ArbitraryArgs never returns an error.
func ArbitraryArgs(cmd *Command, args []string) error {
func ArbitraryArgs(_ *Command, _ []string) error {
return nil
}

View file

@ -614,8 +614,8 @@ func argsMinusFirstX(args []string, x string) []string {
}
func isFlagArg(arg string) bool {
return ((len(arg) >= 3 && arg[1] == '-') ||
(len(arg) >= 2 && arg[0] == '-' && arg[1] != '-'))
return (len(arg) >= 3 && arg[1] == '-') ||
(len(arg) >= 2 && arg[0] == '-' && arg[1] != '-')
}
// Find the target command given the args and command tree

View file

@ -168,7 +168,7 @@ func (c *Command) initCompleteCmd(args []string) {
// 2- Even without completions, we need to print the directive
}
noDescriptions := (cmd.CalledAs() == ShellCompNoDescRequestCmd)
noDescriptions := cmd.CalledAs() == ShellCompNoDescRequestCmd
for _, comp := range completions {
if noDescriptions {
// Remove any description that may be included following a tab character.

View file

@ -38,7 +38,7 @@ func (c *Command) GenZshCompletionNoDesc(w io.Writer) error {
// ShellCompDirectiveFilterFileExt.
//
// Deprecated
func (c *Command) MarkZshCompPositionalArgumentFile(argPosition int, patterns ...string) error {
func (c *Command) MarkZshCompPositionalArgumentFile(_ int, _ ...string) error {
return nil
}
@ -49,7 +49,7 @@ func (c *Command) MarkZshCompPositionalArgumentFile(argPosition int, patterns ..
// any argument (can include the first one also).
//
// Deprecated
func (c *Command) MarkZshCompPositionalArgumentWords(argPosition int, words ...string) error {
func (c *Command) MarkZshCompPositionalArgumentWords(_ int, _ ...string) error {
return nil
}