Skip to content
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

Issue #107: add basic zsh completion (command hierarchy only) #497

Merged
merged 3 commits into from
Jul 30, 2017
Merged

Issue #107: add basic zsh completion (command hierarchy only) #497

merged 3 commits into from
Jul 30, 2017

Conversation

bpicode
Copy link
Contributor

@bpicode bpicode commented Jul 24, 2017

Support for flags still missing though. Maybe we can go from here.

@CLAassistant
Copy link

CLAassistant commented Jul 24, 2017

CLA assistant check
All committers have signed the CLA.

}

func (fw *fWriter) fWriteLn(format string, a ...interface{}) (int, error) {
return io.WriteString(fw, fmt.Sprintf(format+"\n", a...))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this fWriter struct.
Why don't you use just fmt.Fprintln(w, format, a1, a2) like in bash_completions.go? It's simpler and nicer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah sure, I can change to fmt.Fprintln, I don't mind.

byParent := groupByParent(commands)

for p, c := range byParent {
names := names(c)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variable names defined but not used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used two lines below?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, I didn't notice it.

@n10v
Copy link
Collaborator

n10v commented Jul 25, 2017

@eparis @anthonyfok

@n10v
Copy link
Collaborator

n10v commented Jul 26, 2017

LGTM but I know nothing about zsh syntax and how it works.
So I will wait to merge till someone, who knows something about zsh, reviews it and says the conclusion.

@bpicode
Copy link
Contributor Author

bpicode commented Jul 26, 2017

I'm also far from being a zsh expert ;)

@nono
Copy link

nono commented Jul 28, 2017

LGTM

I'm a zsh user that has written some zsh syntax files, but I'm far from being an expert. This PR adds basic completion (as stated in the title of this PR). I think it is a good start for having a complete zsh completion support in cobra.

Copy link
Collaborator

@anthonyfok anthonyfok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! Thank you for your contribution!
Let's give it a try! 😄

@anthonyfok anthonyfok merged commit 1bdc55b into spf13:master Jul 30, 2017
anthonyfok pushed a commit that referenced this pull request Jul 30, 2017
nvanbenschoten added a commit to nvanbenschoten/cockroach that referenced this pull request Apr 2, 2018
This change extends the `cockroach gen autocomplete` command to support
the generation of `zsh` completion files. This has been supported
by `spf13/cobra` since spf13/cobra#497.

Release note (cli change): The "gen autocomplete" command can now
generator zsh-compatible completion files by passing "zsh" as an
argument.
nvanbenschoten added a commit to nvanbenschoten/cockroach that referenced this pull request Apr 2, 2018
This change extends the `cockroach gen autocomplete` command to support
the generation of `zsh` completion files. This has been supported
by `spf13/cobra` since spf13/cobra#497.

Release note (cli change): The "gen autocomplete" command can now
generator zsh-compatible completion files by passing "zsh" as an
argument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants