3 ms·
Very smooth, downloaded it and played around a bit. My first thought is why not use built-in shell autocompletion functions instead of redefining them in JS?
by nathancahill 5y ago
Very smooth, downloaded it and played around a bit.
My first thought is why not use built-in shell autocompletion functions instead of redefining them in JS?
Zsh completions are super powerful: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org https://github.com/zsh-users/zsh-completions/blob/master/zsh...
Typing `git a<TAB>` yields this in my terminal:
~ git add
add -- add file contents to index
am -- apply patches from a mailbox
apply -- apply patch to files and/or to index
archimport -- import an Arch repository into git
archive -- create archive of files from named tree
(btw, broken link at the bottom of this page: https://fig.io/docs/getting-started https://fig.io/docs/getting-started - https://fig.io/concepts/dynamic-suggestions https://fig.io/concepts/dynamic-suggestions should be https://fig.io/docs/concepts/dynamic-suggestions https://fig.io/docs/concepts/dynamic-suggestions)
- mschrage 5y agoThis is something we definitely should add as a fallback when a Fig completion spec doesn't exist! The reason we created our own standard is because traditional shell autocomplete doesn't always provide metadata, like descriptions, priority or icons. Also it is a little tricky to write by hand, unless you're pretty familiar with shell scripting.
- verdverm 5y agoMany CLI libraries provide the ability to generate auto-completion scripts. Cobra for Golang is an excellent example. It provides functions for all the major shells and is quite simple to add to any Go CLI using the library. It also supports dynamic calls for when someone wants to autocomplete on a resource known only to the running CLI. For python argparse, there is argcomplete in the same vein
- mschrage 5y agoWe're building out integrations with CLI libraries like cobra and oclif[0], so you can generate a Fig completion spec automatically the same way! Then it just comes down to the Fig popover UX. [0] https://github.com/withfig/oclif-plugin https://github.com/withfig/oclif-plugin
- verdverm 5y agoDoes Fig then need to mirror autocomplete for any command which wants to make use of the popover UX? (one of the reasons I would not want this tool, colors and file extensions are sufficient for types, no need for icons, popups, and yet another tool)
- oddmiral 5y agoble.sh[0] is also good autocompletion and syntax highlighting solution for bash. [0]: https://github.com/akinomyoga/ble.sh https://github.com/akinomyoga/ble.sh
- stackbeard 5y agoI have this in my zshrc. Hopefully it is helpful to others: # tab completion setopt hash_list_all # https://stackoverflow.com/a/14900496/8514646 bindkey '^i' expand-or-complete-prefix # by category # https://old.reddit.com/r/zsh/comments/6l797o/organizing_co mpletions_by_category/ # https://github.com/sorinionescu/prezto/blob/master/modules/completion/init.zsh#L60 zstyle ':completion:*:*:*:*:*' menu select zstyle ':completion:*:matches' group 'yes' zstyle ':completion:*:options' description 'yes' zstyle ':completion:*:options' auto-description '%d' zstyle ':completion:*:corrections' format ' %F{green}-- %d (errors: %e) --%f' zstyle ':completion:*:descriptions' format ' %F{yellow}-- %d --%f' zstyle ':completion:*:messages' format ' %F{purple} -- %d -- %f' zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f' zstyle ':completion:*:default' list-prompt '%S%M matches%s' zstyle ':completion:*' format ' %F{yellow}-- %d --%f' zstyle ':completion:*' group-name '' zstyle ':completion:*' verbose yes `