Repository navigation
Zsh completions - #1133
Zsh completions#1133sinbad wants to merge 14 commits into
Conversation
|
|
||
| "github.com/github/git-lfs/vendor/_nuts/github.com/spf13/pflag" | ||
|
|
||
| "github.com/github/git-lfs/vendor/_nuts/github.com/spf13/cobra" |
There was a problem hiding this comment.
Do you run goimports? Seems like it should've removed that blank line on line 11.
There was a problem hiding this comment.
Yeah, my Sublime setup runs goimports every time I save, it obviously doesn't strips blanks.
| ) | ||
|
|
||
| func initCommand(cmd *cobra.Command, args []string) { | ||
| fmt.Fprintf(os.Stderr, "WARNING: 'git lfs init' is deprecated. Use 'git lfs install' now.\n") |
There was a problem hiding this comment.
Why'd you take these warnings out?
There was a problem hiding this comment.
I'm using the Deprecated string on cobra.Command instead which prints a warning when you use it (also lets me detect deprecated commands and ignore them)
|
This works pretty well, but I don't think it's quite ready for v1.2. First, subcommand arguments don't work: Second, I'd still really like to figure out how to autocomplete with A "nice to have" would be some integration with |
|
Do you have the Yeah I'd really like to autocomplete |
|
I hate to kill this, you did great work @sinbad. I just don't think it's worth doing if it doesn't work with EDIT: of course we can always bring it back if someone can figure it out. |
|
You should be able to get |
|
@robobenklein I wasn't able to make this work with the snippet you provided (switching |
|
I have yet to define any of the subcommands yet, but I get first-level completion for Note that the subcommand completions need to be sourced to run the It gives me completion like this: |
|
Hi @robobenklein, I can confirm that your script completes correctly for command invocations of the form It looks like git/git@085e2ee allows us to do just that. If you're interested in working on this topic, can you please prepare something that will work with the above? |
|
Got it working with both You should just be able to drop it in the fpath now. Also implemented fetch/ls-files/push subcommands. https://asciinema.org/a/MXbve4MbOHo7dpnc4r2lhdpPC (alias g=git) I don't know what that |
|
I have working ZSH completion for With the last updates to git, the only step required to install is to add that I can continue to expand/finish this handwritten version, or I could start on the automatic generation of the script like this PR had - but I'm not familiar with Go so it might take be a bit longer. @sinbad are you still interested in working on this issue? If so, I'd be willing to help out with whatever ZSH-specific issues you have. |
Hi, when I attempt to install this, I get: $ echo $0
-zsh
$ pbpaste > _git-lfs.zsh
$ source _git-lfs.zsh
_arguments:comparguments:325: can only be called from completion functionBut I am still hesitant to ship a ZSH-only solution, when built-in Git support is coming in a future release (as noted above.) |
|
Ah, there's not really the The _git-lfs completion file needs to placed in the On Ubuntu, it would look like this: |

Replaces #727
Generates the zsh completion script dynamically from a combination of Cobra data and the ManPages dictionary. Tested with ohmyzsh so far.
So far only works with
git-lfscommand, notgit lfs. I've tried to make this work and I can get as far as overriding thegitcompletion in this script, but can't figure out how to only override it for thelfssubcommand and delegate back to the original completions for everything else. My script-fu is not strong enough yet.