Skip to content

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.

2 participants