3 ms·
Traditional shell completions are quite difficult to make. Many CLI tools have completions for subcommands and options, but not for arguments. Only the big CLI
by brendanfalk 5y ago
Traditional shell completions are quite difficult to make. Many CLI tools have completions for subcommands and options, but not for arguments. Only the big CLI tools like `git` and `docker` have arguments completions (e.g. git push [remote] [branch]`.
Fig's declarative schema makes building the completions for subcommands, options and arguments very easy. This means we can support much more powerful autocomplete for many more CLIs.
Fig's standard format also makes it possible to suggest shortcuts for standard workflows (similar to aliases but more visual).
Finally, zsh and fish have good support for traditional autocomplete, but bash does not. Fig works the same across all shells (even when in an SSH session or a docker container).
- yogevyuval 5y agoWhat exactly do you mean by even when in SSH or docker?
- brendanfalk 5y agoAs in, if you SSH into a remote machine, Fig can offer completions for that remote machine. Same thing if you are running an interactive terminal for a docker container. This image may help clarify: https://fig.io/images/slideshow/screenshots/ssh.png https://fig.io/images/slideshow/screenshots/ssh.png
- krrrh 5y agoThis seems like black magic, but it really does raise a lot of questions about the telemetry issue. It's one thing to potentially leak information from your own machine, but leaking data from remote servers you ssh into requires a whole 'nother level of assurity around privacy. That said, it's pretty attractive because it's much harder to make a case to install fish on remote servers.
- evil-olive 5y agoI assume this is done by running 'ls' in the background and not showing the execution to the user, except as autocomplete suggestions? if I type 'sudo cp ' will it run 'sudo ls' to offer suggestions? this...is not good. my terminal should not be executing code on my behalf on remote servers I've SSHed to.
- gtf21 5y agoSo wouldn't a better solution be to make a nicer DSL for describing shell completions which is then translated into zsh, fish, etc. completions? Agree RE bash but at some point doesn't one just use the tool with the featureset one wants?
- mschrage 5y agoThat's how we think about the completion spec standard. It essentially is a type-safe DSL that describes the structure of CLI tools. It should be pretty easy to 'compile' a Fig completion spec down to zsh, fish, or bash. This is actually something I've been meaning to write!
- skratlo 5y ago> Fig's standard format How is that a standard when you just came up with it? Any other existing autocompletion format is more standard than whatever you just released.
- brendanfalk 5y agoYep I mistyped. Meant to say standard "suggestion" format. Trying to imply that each suggestion conforms to a specific standard that we have set but that lets you customise things like the text it suggests, what is inserted, icon etc