From 0abc481ead5db8e7b588a23d8e9706fba3524b75 Mon Sep 17 00:00:00 2001 From: lucapette Date: Wed, 16 Aug 2017 17:04:28 +0200 Subject: [PATCH] Minor docs fixes to completion feature --- README.md | 17 ++--------------- pkg/fakedata/completion.go | 2 +- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index fe7b3bb..7bda120 100644 --- a/README.md +++ b/README.md @@ -330,25 +330,12 @@ example to display a full name in the format `Lastname Firstname` instead of # Completion -`fakedata` supports shell tab completion for bash and zsh shells. To enable - completion execute one of the following commands to append the completion - function to your `.bashrc` or `.zshrc` file. +`fakedata` supports shell tab completion for bash and zsh shells: ```sh -$ fakedata --completion bash >> $HOME/.bashrc -$ fakedata --completion zsh >> $HOME/.zshrc +$ eval "$(fakedata --completion zsh)" # or bash ``` -Alternatively for bash you can also add a file to `/etc/bash_completion.d/` -named `fakedata`: - -```sh -$ fakedata --completion bash >> /etc/bash_completion.d/fakedata -``` - -As of now you'll need to update the `/etc/bash_completion.d/fakedata` file or -the function inside `.bashrc` / `.zshrc` when you update fakedata. - # How to install ## Homebrew diff --git a/pkg/fakedata/completion.go b/pkg/fakedata/completion.go index f7b46af..9394663 100644 --- a/pkg/fakedata/completion.go +++ b/pkg/fakedata/completion.go @@ -56,7 +56,7 @@ func GetCompletionFunc(shell string) (string, error) { } pflag.VisitAll(func(f *pflag.Flag) { - fmt.Fprintf(allCliArgs, "-%s --%s ", f.Shorthand, f.Name) + fmt.Fprintf(allCliArgs, "--%s ", f.Name) }) cmdList := gens.String() + " " + allCliArgs.String()