From ae37156f634973d59186b69de0623c866f77415b Mon Sep 17 00:00:00 2001 From: Jack Wright Date: Sun, 29 Dec 2024 13:23:29 -0800 Subject: [PATCH] Removing unused includeDesc parameter --- completions.go | 2 +- nushell_completions.go | 6 +++--- nushell_completions_test.go | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/completions.go b/completions.go index 1e5a4f5..9bee0a6 100644 --- a/completions.go +++ b/completions.go @@ -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 { diff --git a/nushell_completions.go b/nushell_completions.go index d1740d1..830ffe4 100644 --- a/nushell_completions.go +++ b/nushell_completions.go @@ -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) } diff --git a/nushell_completions_test.go b/nushell_completions_test.go index db58cbd..41a98f4 100644 --- a/nushell_completions_test.go +++ b/nushell_completions_test.go @@ -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