mirror of
https://github.com/spf13/cobra
synced 2024-11-24 22:57:12 +00:00
refactor(cobra): small refactor
This commit is contained in:
parent
cb9d7b1cec
commit
c969c6c796
4 changed files with 6 additions and 6 deletions
2
args.go
2
args.go
|
@ -52,7 +52,7 @@ func OnlyValidArgs(cmd *Command, args []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ArbitraryArgs never returns an error.
|
// ArbitraryArgs never returns an error.
|
||||||
func ArbitraryArgs(cmd *Command, args []string) error {
|
func ArbitraryArgs(_ *Command, _ []string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -614,8 +614,8 @@ func argsMinusFirstX(args []string, x string) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func isFlagArg(arg string) bool {
|
func isFlagArg(arg string) bool {
|
||||||
return ((len(arg) >= 3 && arg[1] == '-') ||
|
return (len(arg) >= 3 && arg[1] == '-') ||
|
||||||
(len(arg) >= 2 && arg[0] == '-' && arg[1] != '-'))
|
(len(arg) >= 2 && arg[0] == '-' && arg[1] != '-')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the target command given the args and command tree
|
// Find the target command given the args and command tree
|
||||||
|
|
|
@ -168,7 +168,7 @@ func (c *Command) initCompleteCmd(args []string) {
|
||||||
// 2- Even without completions, we need to print the directive
|
// 2- Even without completions, we need to print the directive
|
||||||
}
|
}
|
||||||
|
|
||||||
noDescriptions := (cmd.CalledAs() == ShellCompNoDescRequestCmd)
|
noDescriptions := cmd.CalledAs() == ShellCompNoDescRequestCmd
|
||||||
for _, comp := range completions {
|
for _, comp := range completions {
|
||||||
if noDescriptions {
|
if noDescriptions {
|
||||||
// Remove any description that may be included following a tab character.
|
// Remove any description that may be included following a tab character.
|
||||||
|
|
|
@ -38,7 +38,7 @@ func (c *Command) GenZshCompletionNoDesc(w io.Writer) error {
|
||||||
// ShellCompDirectiveFilterFileExt.
|
// ShellCompDirectiveFilterFileExt.
|
||||||
//
|
//
|
||||||
// Deprecated
|
// Deprecated
|
||||||
func (c *Command) MarkZshCompPositionalArgumentFile(argPosition int, patterns ...string) error {
|
func (c *Command) MarkZshCompPositionalArgumentFile(_ int, _ ...string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ func (c *Command) MarkZshCompPositionalArgumentFile(argPosition int, patterns ..
|
||||||
// any argument (can include the first one also).
|
// any argument (can include the first one also).
|
||||||
//
|
//
|
||||||
// Deprecated
|
// Deprecated
|
||||||
func (c *Command) MarkZshCompPositionalArgumentWords(argPosition int, words ...string) error {
|
func (c *Command) MarkZshCompPositionalArgumentWords(_ int, _ ...string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue