Removing unused includeDesc parameter

This commit is contained in:
Jack Wright 2024-12-29 13:23:29 -08:00
parent 997ac04e61
commit ae37156f63
3 changed files with 8 additions and 8 deletions

View file

@ -868,7 +868,7 @@ https://www.nushell.sh/cookbook/external_completers.html#multiple-completer
Args: NoArgs,
ValidArgsFunction: NoFileCompletions,
RunE: func(cmd *Command, args []string) error {
return cmd.Root().GenNushellCompletion(out, !noDesc)
return cmd.Root().GenNushellCompletion(out)
},
}
if haveNoDescFlag {

View file

@ -21,7 +21,7 @@ import (
"os"
)
func (c *Command) GenNushellCompletion(w io.Writer, includeDesc bool) error {
func (c *Command) GenNushellCompletion(w io.Writer) error {
buf := new(bytes.Buffer)
WriteStringAndCheck(buf, "# nushell completion -*- shell-script -*- \n")
WriteStringAndCheck(buf, fmt.Sprintf(`
@ -120,12 +120,12 @@ let cobra_completer = {|spans|
return err
}
func (c *Command) GenNushellCompletionFile(filename string, includeDesc bool) error {
func (c *Command) GenNushellCompletionFile(filename string) error {
outFile, err := os.Create(filename)
if err != nil {
return err
}
defer outFile.Close()
return c.GenNushellCompletion(outFile, includeDesc)
return c.GenNushellCompletion(outFile)
}

View file

@ -38,7 +38,7 @@ func TestGenNushellCompletion(t *testing.T) {
rootCmd.AddCommand(getCmd)
buf := new(bytes.Buffer)
assertNoErr(t, rootCmd.GenNushellCompletion(buf, true))
assertNoErr(t, rootCmd.GenNushellCompletion(buf))
}
func TestGenNushellCompletionFile(t *testing.T) {
@ -57,7 +57,7 @@ func TestGenNushellCompletionFile(t *testing.T) {
}
rootCmd.AddCommand(child)
assertNoErr(t, rootCmd.GenNushellCompletionFile(tmpFile.Name(), true))
assertNoErr(t, rootCmd.GenNushellCompletionFile(tmpFile.Name()))
}
func TestFailGenNushellCompletionFile(t *testing.T) {
@ -79,7 +79,7 @@ func TestFailGenNushellCompletionFile(t *testing.T) {
}
rootCmd.AddCommand(child)
got := rootCmd.GenNushellCompletionFile(f.Name(), false)
got := rootCmd.GenNushellCompletionFile(f.Name())
if !errors.Is(got, os.ErrPermission) {
t.Errorf("got: %s, want: %s", got.Error(), os.ErrPermission.Error())
}
@ -89,7 +89,7 @@ func TestNushellCompletionNoActiveHelp(t *testing.T) {
c := &Command{Use: "c", Run: emptyRun}
buf := new(bytes.Buffer)
assertNoErr(t, c.GenNushellCompletion(buf, true))
assertNoErr(t, c.GenNushellCompletion(buf))
output := buf.String()
// check that active help is being disabled