Skip to content

Commit

Permalink
Merge pull request #59 from lucapette/completion-docs
Browse files Browse the repository at this point in the history
Minor docs fixes to completion feature
  • Loading branch information
lucapette authored Aug 16, 2017
2 parents ef284f3 + 0abc481 commit d91dcb4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
17 changes: 2 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/fakedata/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit d91dcb4

Please sign in to comment.