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

add fish completion support #754

Closed

Conversation

0robustus1
Copy link

This adds generation of fish autocompletion as suggested in #350.

It should support the following types of completion:

  • subcommands
    • including the deactivation of subcommand completion after a local non-persistent flag
  • long and short flags (with boolean flags not taking arguments and all other flags requiring an argument)
  • arguments to subcommands (per ValidArgs and ArgAliases)

@JHK tested the completion by integrating it with kubectl. We are planning to integrate fish completion with kubectl after it is available in cobra.

@CLAassistant
Copy link

CLAassistant commented Sep 26, 2018

CLA assistant check
All committers have signed the CLA.

@0robustus1
Copy link
Author

0robustus1 commented Sep 26, 2018

It seems that there is a difference of opinion between gofmt in the go-current tests and go-latest.
The same issue seems to occur on current master commits.
Maybe you can take a look as to how this could be resolved? (see also #737)

@lwolfsonkin
Copy link

bump

@wwentland
Copy link

It would be lovely to see this merged, so that kubernetes/kubectl#131 can be addressed.

@0robustus1
Copy link
Author

@eparis could you take a look at this?

@davewongillies
Copy link

Sorry for the noise, but @0robustus1 are you going to finish this off?

@0robustus1
Copy link
Author

Hi @davewongillies. AFAIK there aren't any action items that would need to be completed.
In a previous comment i mentioned that the test-suite is failing due to a change in gofmt regarding
formatting that isn't compatible with prior versions or future versions (a.k.a. go-current at the time, go-latest and go-previous work fine).

As far as i am concerned this waiting for interaction with the PR by a maintainer, e.g. regarding review or guidance how to proceed with the test-suite (e.g. updating go-current, *-latest and *-previous references). I as well as others have tried reaching the maintainers, but we haven't heard anything so far.

@davewongillies
Copy link

@0robustus1 so it looks like #737 got merged in earlier in the year, which probably handles the test for go-current failing. I rebased your branch from master in my own fork, reverted your last commit 875c5ee, then created a draft PR and all the tests pass: #865

https://circleci.com/gh/spf13/cobra/1259
https://circleci.com/gh/spf13/cobra/1258
https://circleci.com/gh/spf13/cobra/1257

@0robustus1 0robustus1 force-pushed the 350-add_fish_completion_support branch from 875c5ee to 64400ad Compare May 22, 2019 07:46
@0robustus1
Copy link
Author

@davewongillies thx, i hadn't noticed that this particular PR got merged. I performed the rebase.

@twpayne
Copy link
Contributor

twpayne commented Sep 9, 2019

Any chance of this getting merged?

@aybabtme
Copy link

aybabtme commented Sep 24, 2019

@spf13 is there someone else than @eparis who could review/approve/merge this? The PR is almost a year old, and it would make a lot of tools much more pleasant to use out in the wild for all fish users.

@morozov
Copy link

morozov commented Sep 24, 2019

So far, I tried this PR by compiling GoogleContainerTools/skaffold with the patched spf13/cobra, and it produced a working completion. Then I put the generated competition in my dotfiles. It's a PITA but it works. I wish it was accepted sooner so the dependents could pick up the new API.

@0robustus1
Copy link
Author

As of yesterday this Pull-Request is officially 1 year old (Happy Birthday btw. 🎉 ).

I'll therefore give this one more try:
@jharshman, @BoGeM and of course @spf13 I'm pinging you because you recently (within 2019) actively pushed commits to this repository. I would ask you to take a look at this Pull-Request if you have some time. It would be highly appreciated. If i can help in any way in furthering the Review (and hopefully subsequent merge) of this Pull-Request along, let me know.

@umarcor
Copy link
Contributor

umarcor commented Sep 30, 2019

@0robustus1, I feel it pertinent to ref #959 here.

umarcor pushed a commit to umarcor/cobra that referenced this pull request Oct 2, 2019
* add fish completion basics to cobra.
* add helpCommand check to fish completions.
* add basic tests for fish completion.
* support ValidArgs completion of commands in fish.
* add additional support for argument aliases.
* remove oly mention.
* use custom function for checking subcommand path.
* use fish builtin for flag/argument checking.
* backport __fish_seen_argument.
* escape description of commands & flags.
* allow subcommand_path to match even with flags
* deal with unreachable code warning.
umarcor pushed a commit to umarcor/cobra that referenced this pull request Oct 2, 2019
* add fish completion basics to cobra.
* add helpCommand check to fish completions.
* add basic tests for fish completion.
* support ValidArgs completion of commands in fish.
* add additional support for argument aliases.
* remove oly mention.
* use custom function for checking subcommand path.
* use fish builtin for flag/argument checking.
* backport __fish_seen_argument.
* escape description of commands & flags.
* allow subcommand_path to match even with flags
* deal with unreachable code warning.
umarcor pushed a commit to umarcor/cobra that referenced this pull request Oct 14, 2019
* add fish completion basics to cobra.
* add helpCommand check to fish completions.
* add basic tests for fish completion.
* support ValidArgs completion of commands in fish.
* add additional support for argument aliases.
* remove oly mention.
* use custom function for checking subcommand path.
* use fish builtin for flag/argument checking.
* backport __fish_seen_argument.
* escape description of commands & flags.
* allow subcommand_path to match even with flags
* deal with unreachable code warning.
@dhollinger
Copy link

Can we get someone to approve/merge this? @spf13 @eparis ?

Pretty please?

umarcor pushed a commit to umarcor/cobra that referenced this pull request Jan 4, 2020
* add fish completion basics to cobra.
* add helpCommand check to fish completions.
* add basic tests for fish completion.
* support ValidArgs completion of commands in fish.
* add additional support for argument aliases.
* remove oly mention.
* use custom function for checking subcommand path.
* use fish builtin for flag/argument checking.
* backport __fish_seen_argument.
* escape description of commands & flags.
* allow subcommand_path to match even with flags
* deal with unreachable code warning.
umarcor pushed a commit to umarcor/cobra that referenced this pull request Jan 6, 2020
* add fish completion basics to cobra.
* add helpCommand check to fish completions.
* add basic tests for fish completion.
* support ValidArgs completion of commands in fish.
* add additional support for argument aliases.
* remove oly mention.
* use custom function for checking subcommand path.
* use fish builtin for flag/argument checking.
* backport __fish_seen_argument.
* escape description of commands & flags.
* allow subcommand_path to match even with flags
* deal with unreachable code warning.
umarcor pushed a commit to umarcor/cobra that referenced this pull request Jan 22, 2020
* add fish completion basics to cobra.
* add helpCommand check to fish completions.
* add basic tests for fish completion.
* support ValidArgs completion of commands in fish.
* add additional support for argument aliases.
* remove oly mention.
* use custom function for checking subcommand path.
* use fish builtin for flag/argument checking.
* backport __fish_seen_argument.
* escape description of commands & flags.
* allow subcommand_path to match even with flags
* deal with unreachable code warning.
umarcor pushed a commit to umarcor/cobra that referenced this pull request Jan 22, 2020
* add fish completion basics to cobra.
* add helpCommand check to fish completions.
* add basic tests for fish completion.
* support ValidArgs completion of commands in fish.
* add additional support for argument aliases.
* remove oly mention.
* use custom function for checking subcommand path.
* use fish builtin for flag/argument checking.
* backport __fish_seen_argument.
* escape description of commands & flags.
* allow subcommand_path to match even with flags
* deal with unreachable code warning.
@floriankoch
Copy link

any plans to merge this?

@mislav mislav mentioned this pull request Jan 29, 2020
2 tasks
umarcor pushed a commit to umarcor/cobra that referenced this pull request Feb 3, 2020
* add fish completion basics to cobra.
* add helpCommand check to fish completions.
* add basic tests for fish completion.
* support ValidArgs completion of commands in fish.
* add additional support for argument aliases.
* remove oly mention.
* use custom function for checking subcommand path.
* use fish builtin for flag/argument checking.
* backport __fish_seen_argument.
* escape description of commands & flags.
* allow subcommand_path to match even with flags
* deal with unreachable code warning.
@umarcor umarcor mentioned this pull request Feb 3, 2020
umarcor pushed a commit to umarcor/cobra that referenced this pull request Feb 20, 2020
* add fish completion basics to cobra.
* add helpCommand check to fish completions.
* add basic tests for fish completion.
* support ValidArgs completion of commands in fish.
* add additional support for argument aliases.
* remove oly mention.
* use custom function for checking subcommand path.
* use fish builtin for flag/argument checking.
* backport __fish_seen_argument.
* escape description of commands & flags.
* allow subcommand_path to match even with flags
* deal with unreachable code warning.
umarcor pushed a commit to umarcor/cobra that referenced this pull request Mar 1, 2020
* add fish completion basics to cobra.
* add helpCommand check to fish completions.
* add basic tests for fish completion.
* support ValidArgs completion of commands in fish.
* add additional support for argument aliases.
* remove oly mention.
* use custom function for checking subcommand path.
* use fish builtin for flag/argument checking.
* backport __fish_seen_argument.
* escape description of commands & flags.
* allow subcommand_path to match even with flags
* deal with unreachable code warning.
@nesl247
Copy link

nesl247 commented Mar 27, 2020

Seems like #1048 may be replacing this.

@jharshman
Copy link
Collaborator

@nesl247 correct, #1048 will replace this.

@z3ntu
Copy link

z3ntu commented Apr 14, 2020

#1048 is merged

@xordspar0
Copy link

Great! This can be closed now.

@jharshman jharshman closed this Apr 15, 2020
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.