-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add bash shell completion command #3084
Conversation
dgraph/cmd/root.go
Outdated
. < (dgraph completion) | ||
`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
RootCmd.GenBashCompletion(os.Stdout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of RootCmd.GenBashCompletion
is not checked (from errcheck
)
Tried it out. It seems pretty useful. Here's what it like it action (
|
dgraph completion command with two subcommands for bash and zsh.
Zsh completion isn't working for me.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that shell completion would be helpful but I'm not sure that it should be a core dgraph command. The output is fixed for a given dgraph release. The same could be accomplished by just adding static completion files to the release package.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @srfrog)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is useful. Either the user or our install scripts can use this to set up auto-completion based on whichever version dgraph is.
Reviewed 1 of 1 files at r2.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @srfrog)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @golangcibot)
dgraph/cmd/root.go, line 167 at r1 (raw file):
Previously, golangcibot (Bot from GolangCI) wrote…
Error return value of
RootCmd.GenBashCompletion
is not checked (fromerrcheck
)
Done.
* dgraph/cmd/root.go: add bash shell completion command * dgraph/cmd/root.go: add zsh shell completion dgraph completion command with two subcommands for bash and zsh. * dgraph/cmd/root.go: add usage instructions and help
This PR adds a new
completion
command to the Dgraph main binary. It is used to generate bash and zsh shell completion code.Bash example:
This change is