From c969c6c79659de5198ce34d1bbe9375f8f22e566 Mon Sep 17 00:00:00 2001 From: Sasha Melentyev Date: Fri, 24 Dec 2021 05:21:08 +0300 Subject: [PATCH] refactor(cobra): small refactor --- args.go | 2 +- command.go | 4 ++-- completions.go | 2 +- zsh_completions.go | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/args.go b/args.go index 20a022b3..0939321a 100644 --- a/args.go +++ b/args.go @@ -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 } diff --git a/command.go b/command.go index 2cc18891..cdc6071b 100644 --- a/command.go +++ b/command.go @@ -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 diff --git a/completions.go b/completions.go index 9ecd56a4..42403a21 100644 --- a/completions.go +++ b/completions.go @@ -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. diff --git a/zsh_completions.go b/zsh_completions.go index 624adab5..a5e03500 100644 --- a/zsh_completions.go +++ b/zsh_completions.go @@ -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 }