From 97f831a4fd01378ad85840fed4f43824bc3dd102 Mon Sep 17 00:00:00 2001 From: Anthony Fok Date: Mon, 11 Jan 2016 15:37:32 -0700 Subject: [PATCH] Change first line of generated bash-completion file to conform with existing bash-completion snippets and to suppress Lintian "script-not-executable". --- bash_completions.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bash_completions.go b/bash_completions.go index d30c6b5..7457d85 100644 --- a/bash_completions.go +++ b/bash_completions.go @@ -16,9 +16,12 @@ const ( BashCompSubdirsInDir = "cobra_annotation_bash_completion_subdirs_in_dir" ) -func preamble(out io.Writer) error { - _, err := fmt.Fprintf(out, `#!/bin/bash - +func preamble(out io.Writer, name string) error { + _, err := fmt.Fprintf(out, "# bash completion for %-36s -*- shell-script -*-\n", name) + if err != nil { + return err + } + _, err = fmt.Fprintf(out, ` __debug() { if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then @@ -465,7 +468,7 @@ func gen(cmd *Command, w io.Writer) error { } func (cmd *Command) GenBashCompletion(w io.Writer) error { - if err := preamble(w); err != nil { + if err := preamble(w, cmd.Name()); err != nil { return err } if len(cmd.BashCompletionFunction) > 0 {