Skip to content

Commit

Permalink
Explain better how to install completion script
Browse files Browse the repository at this point in the history
Current hint suggests adding a line into `.bashrc` that adds a line into `.bashrc`, what is incorrect.

Signed-off-by: David Pordomingo <david.pordomingo.f@gmail.com>

Signed-off-by: David Pordomingo <David.Pordomingo.F@gmail.com>
  • Loading branch information
dpordomingo committed Aug 13, 2019
1 parent b3f24f7 commit 029cbd2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func InitCompletionCommand(appname string) func(*flags.Command) {
t := template.Must(template.New("desc").Parse(
`Print a bash completion script for {{.Name}}.
You can place it on /etc/bash_completion.d/{{.Name}}, or add it to your .bashrc:
You can place it on /etc/bash_completion.d/{{.Name}}, or add it to your .bashrc running:
echo "source <({{.Name}} completion)" >> ~/.bashrc
`))

Expand All @@ -37,7 +37,9 @@ func (c CompletionCommand) Execute(args []string) error {
t := template.Must(template.New("completion").Parse(
`# Save this file to /etc/bash_completion.d/{{.Name}}
#
# or add the following line to your .bashrc file:
# or add the following line to your .bashrc file:
# source <({{.Name}} completion)
# running:
# echo "source <({{.Name}} completion)" >> ~/.bashrc
_completion-{{.Name}}() {
Expand Down
7 changes: 5 additions & 2 deletions completion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ func TestCompletionCommand(t *testing.T) {
require.Equal(
`# Save this file to /etc/bash_completion.d/test
#
# or add the following line to your .bashrc file:
# or add the following line to your .bashrc file:
# source <(test completion)
# running:
# echo "source <(test completion)" >> ~/.bashrc
_completion-test() {
Expand Down Expand Up @@ -77,7 +79,8 @@ func TestCompletionHelpCommand(t *testing.T) {
Print a bash completion script for test.
You can place it on /etc/bash_completion.d/test, or add it to your .bashrc:
You can place it on /etc/bash_completion.d/test, or add it to your .bashrc
running:
echo "source <(test completion)" >> ~/.bashrc
Expand Down

0 comments on commit 029cbd2

Please sign in to comment.