Skip to content

Implementations of Shell Autocompletion

andychu edited this page Nov 22, 2019 · 6 revisions

Back to Shell Autocompletion

bash

  • GNU readline does ad hoc tokenization of the shell command. Does not use its parser.
  • builtins: complete, compopt, compgen
  • global variables: COMP_WORDS, COMPREPLY (out)
  • completions maintained out of tree in bash-completion

yash

  • lineedit/compparse.{c,h} (~1300 lines) is a "simple parser for command line completion" that duplicates knowledge of the shell language. It doesn't use its own parser much, if at all.
  • help complete shows help for the extensive completion builtin. Doesn't seem to understand the flags of its own builtins.
  • completions maintained in-tree in share/completion

As usual, git is one of the biggest completions!

~/src/languages/yash-2.46/share/completion$ wc -l *|sort -n
...
   497 git-config
   541 tar
   554 find
   597 git-svn
   657 INIT
   759 git
   850 svn
 19921 total

zsh

TODO

  • completions maintained in-tree

fish

  • has a complete builtin
  • completions maintained in-tree
Clone this wiki locally