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 bash zsh and nu shell completions #3152

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mmahmoudian
Copy link

I have added shell completions for Bash, Zsh, and Nushell. I don't use Fish shell and on the first look it looked too complicated. Perhaps can be added in another PR.

This is a Draft PR because I don't know how in your build system these files should be integrated. On a typical linux distro bash should sit in /usr/share/bash-completion/completions/ and should be renamed to micro, for zsh it should sit in /usr/share/zsh/site-functions and should be renamed to _micro.

As for Nushell, the documentation is not clear about the path, so I think we should leave it as is, until a Nushell fan help us with that.

@bartekpacia
Copy link
Contributor

Wow thanks a lot! I love shell completions :-) Did you make it manually, or used some kind of automated tool?

Once this is merged, it's worth updating the package managers to automatically install these completions. For example for Homebrew, an additional statement to install completions should be added to the install method. Examples of this from other tools:

@mmahmoudian
Copy link
Author

mmahmoudian commented Mar 16, 2024

I manually created those. I don't know of any automated way to generate them, and I don't think such software exist simply because there so many different styles of CLI:

  • app subcommand --arg=value. For example:
    git clone --depth=1
  • app --arg -a For example:
    pacman --sync -y
  • app -arg -arg (which is my least favorite). For example:
    micro -config-dir -deug
  • app subcommand --arg -- subcommand --arg -- subcommand For example:
    guix time-machine --channels="channel.scm" -- shell --pure --manifest="manifest.scm" -- myfunc --arg1

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

2 participants