--help

--help

ls

ls --fu

Tab

ls --full-time

How Cod works

Demo terminal recording showing how Cod adds autocompletion to the scrcpy command (which doesn't have autocompletion by default)

--help

--help

learn

--always-on-top

--record-format

--window-borderless

scrcpy --help

--help

┌──> /usr/bin/scrcpy --help └─── cod: learn this command? [yn?] > y cod: learned completions: "--always-on-top" "-b" and 35 more

y

scrcpy --a

Tab

--always-on-top

learn

update

list

usage: cod [ ] [ ...] Shell autocomplete generator based on `--help' texts. Flags: --help Show context-sensitive help (also try --help-long and --help-man). --version Show application version. Commands: help [ ...] learn ... list [ ...] remove ... update ... init example-config [ ] daemon [ ]

Download Cod

/usr/local/bin

PATH

sudo install cod /usr/local/bin

~/.bashrc

~/.zshrc

for Bash: open ~/.bashrc with a text editor and at the end of the file add a new line containing:

source <(cod init $$ bash)

for Zsh: open ~/.zshrc with a text editor and at the end of the file add a new line with:

source <(cod init $$ zsh)

~/.bashrc

source ~/.bashrc

~/.zshrc

source ~/.zshrc

Command-line completion (tab completion / autocompletion) is a common feature among command-line interpreters, in which the program automatically fills in partially typed commands when pressing the completion key, which is usually Tab. By using it, fewer keystrokes are required to access common commands, and it makes it easy to autocomplete commands / filenames with long or difficult to spell names.The elements that can be completed are not only commands and filenames, but also command arguments, and this is what Cod does. It parses the output offor a particular command, and based on that it generates autocompletion for Bash or Zsh shells. Some commands already support autocomplete for arguments (for example- typeand pressto autocomplete it to), but some don't and Cod can help in those cases.Cod supports Zsh on macOS and Linux, and Bash only on Linux. Bash on macOS is not supported because, according to the Cod project description, the Bash version that's bundled with macOS is too old and Cod doesn't support it. There's no mention of Windows in the project description, and there are no Windows binaries so it might not support Windows, but I'm not sure since I don't use Windows.For special cases in which Cod doesn't detect that you have invoked the help of a command, use the Codsubcommand to learn it anyway. scrcpy (this can be seen in the demo terminal recording a few lines above). This is a tool to show an Android device's screen on a desktop and control it remotely. The scrcpy command has many options / arguments, like, and more, with no built-in autocomplete support for them.To get Cod to learn the scrcpy command options / arguments, let's run:When running a command with theargument, Cod asks if it should learn that command:Typeto allow it to learn this command.Now that Cod has learned the command arguments, let's give it a try. Typein a terminal and press. The argument should be autocompleted toBesides the already mentionedsubcommand, Cod has some other options like(update a known command),(list known commands), and more. This is the Cod help / usage screen:Visit the Cod project page for more information on how to use and configure it.You can download the source and build Cod, or download and install the prebuilt binary (available for both macOS and Linux).To install the Cod binary on Linux, extract the cod-Linux.tgz archive, open a terminal in the folder where you have extracted the Cod binary, and use this command to install it to(make sure this is in your, or install it somewhere else):You'll also need to add a line to yourorfile to source Cod:Save the file, source the modified(use this command:) and(use) file or open a new terminal and Cod will be ready to use.