Skip to main content

Module shell

Module shell 

Source
Expand description

The shell adapters: the only shell code in the completion, and it knows nothing.

Each adapter below does four things — read the words being completed, find the cursor, ask this executable, print what comes back. There is no command in them, no flag, no identifier, no repository path and no version. That is the property that matters: a command added tomorrow is completed by an adapter loaded a year ago, because the adapter never learned the old set in the first place.

§What a person installs, once

# ~/.zshrc
eval "$(majordomus completion init --shell zsh)"

One line, for every repository. The repository being completed is decided per invocation by where the shell is, which is how one integration serves many checkouts and how leaving a repository leaves nothing behind.

§The text protocol

One candidate per line, value, a tab, the description. Empty output means the engine has nothing to offer, and the adapter falls back to the shell’s own file completion — which is what an argument that takes a path wants, and what an unknown command deserves.

Constants§

ALL
Every adapter, for a test that asserts the property they share.
BASH
The bash integration.
BIN_ENV
The environment variable an adapter reads to find the executable, so that a checkout’s own launcher can be used without a second adapter.
FISH
The fish integration.
ZSH
The zsh integration.