rossmacarthur/sheldon

Support shell completions for ZSH (and/or different shells)

Opened this issue ยท 4 comments

Hi there,
first of all thanks for this nice project. In comparison to the other ZSH managers out there, I found it very pleasing to work with sheldon. ๐Ÿ˜Š

It would be a nice to have shell completions for the different shells, at least for ZSH. :)

@nachtjasmin Hi, could you elaborate on your request, I'm not exactly sure what this feature would look like?

When I press , the shell could automatically suggest certain actions and provide an explanation. Example:

$ git <TAB>
zsh: do you wish to see all 212 possibilities (212 lines)?

and

$ git merge <TAB>
merge          -- join two or more development histories together
merge-base     -- find as good a common ancestor as possible for a merge
merge-file     -- run a three-way file merge
merge-index    -- run merge for files needing merging
merge-into     -- merge one branch into another
merge-one-file -- standard helper-program to use with git merge-index
merge-repo     -- merge two repo histories
merge-tree     -- show three-way merge without touching index
mergetool      -- run merge conflict resolution tools to resolve merge conflicts

are outputs that would be created. chezmoi, for example, a project written in Go, autogenerates these, I don't know if this is possible with your Rust implementation. It would make the execution of certain commands faster to type as I could use the autosuggestions by the shell without invoking sheldon -h first.

Ohhh, I thought you were talking about sheldon managing completions. Yes this makes sense as a feature ๐Ÿ˜„. Looks like we should be able to use clap_complete for this.

Implemented in 08002dc. The completions will be bundled in future release archives. They will also be generatable using sheldon completions --shell bash/zsh. Additionally I will update the Sheldon Homebrew formula to automatically install them.