Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aca/elvish-bash-completion
Elvish completion from bash completion
https://github.com/aca/elvish-bash-completion
Last synced: 3 months ago
JSON representation
Elvish completion from bash completion
- Host: GitHub
- URL: https://github.com/aca/elvish-bash-completion
- Owner: aca
- Created: 2022-02-05T17:28:02.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-02-01T14:29:14.000Z (almost 2 years ago)
- Last Synced: 2024-04-05T22:37:01.650Z (7 months ago)
- Language: Shell
- Size: 42 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-elvish - aca/elvish-bash-completion
README
# elvish-bash-completion
Generalized version of [ezh/elvish-bash-completion](https://github.com/ezh/elvish-bash-completion) with some improvements.
Provides single function `bash-completer:new`, you can convert any bash completion to elvish.It includes submodules for bash completions and also tries to find completion in your host searching through
```
/usr/share/bash-completion/completions/
/usr/local/share/bash-completion/completions/
/usr/local/etc/bash_completion.d/
```## Options
- `bash_function`: Normally completion bash function is named as "_command command", this option is for commands that doesn't follow this convention.
- `completion_filename`: Some completion file is named to `fd.bash` instead of `fd` (on MacOS)## Install
```
# This library includes submodules we can't use epm but we can still install in the same directory.
git clone --recurse-submodules https://github.com/aca/elvish-bash-completion ~/.local/share/elvish/lib/github.com/aca/elvish-bash-completion
```## Usage
You might want to check my [configs](https://github.com/aca/dotfiles/blob/master/.config/elvish/lib/completion.elv) for more.
```
use github.com/aca/elvish-bash-completion/bash-completerset edit:completion:arg-completer[ssh] = (bash-completer:new "ssh")
set edit:completion:arg-completer[scp] = (bash-completer:new "scp")
set edit:completion:arg-completer[curl] = (bash-completer:new "curl")
set edit:completion:arg-completer[man] = (bash-completer:new "man")
set edit:completion:arg-completer[killall] = (bash-completer:new "killall")
set edit:completion:arg-completer[aria2c] = (bash-completer:new "aria2c")
set edit:completion:arg-completer[ip] = (bash-completer:new "ip")
set edit:completion:arg-completer[journalctl] = (bash-completer:new "journalctl")
set edit:completion:arg-completer[tcpdump] = (bash-completer:new "tcpdump")
set edit:completion:arg-completer[iptables] = (bash-completer:new "iptables")
set edit:completion:arg-completer[tmux] = (bash-completer:new "tmux")
set edit:completion:arg-completer[fd] = (bash-completer:new "fd")
set edit:completion:arg-completer[rg] = (bash-completer:new "rg")
set edit:completion:arg-completer[pueue] = (bash-completer:new "pueue")# for some commands, we need to pass bash_function
set edit:completion:arg-completer[gh] = (bash-completer:new "gh" &bash_function="__start_gh")
set edit:completion:arg-completer[pkill] = (bash-completer:new "pkill" &bash_function="pgrep")
set edit:completion:arg-completer[git] = (bash-completer:new "git" &bash_function="__git_wrap__git_main")
set edit:completion:arg-completer[umount] = (bash-completer:new "umount" &bash_function="_umount_module")
set edit:completion:arg-completer[systemctl] = (bash-completer:new "systemctl" &bash_function="_systemctl systemctl")
set edit:completion:arg-completer[virsh] = (bash-completer:new "virsh" &bash_function="_virsh_complete virsh")# builtin completions
set edit:completion:arg-completer[which] = (bash-completer:new "which" &bash_function="_complete type" &completion_filename="complete")# alias
set edit:completion:arg-completer[kubectl] = (bash-completer:new "kubectl" &bash_function="__start_kubectl")
set edit:completion:arg-completer[k] = $edit:completion:arg-completer[kubectl]# specify completion filename for completions with different name
# set edit:completion:arg-completer[rg] = (bash-completer:new "rg" &completion_filename="custom_rg_completion")
```