Skip to main content

ZSH

Constant ZSH 

Source
pub const ZSH: &str = r#"# majordomus — shell completion, generated by `majordomus completion init --shell zsh`.
# Carries no command, no flag and no identifier: every candidate comes from
# `majordomus completion query`, which answers from the command graph of the repository the
# shell is in. Load it once; it serves every repository.
_majordomus_query() {
  local surface="$1"
  local bin="${MAJORDOMUS_COMPLETION_BIN:-majordomus}"
  local -a lines items
  lines=("${(@f)$(command "$bin" completion query --surface "$surface" --format text --cursor "$((CURRENT-1))" -- "${words[@]}" 2>/dev/null)}")
  local line value description
  for line in "${lines[@]}"; do
    [[ -z "$line" ]] && continue
    value="${line%%	*}"
    description="${line#*	}"
    [[ "$description" == "$line" ]] && description=""
    items+=("${value}:${description}")
  done
  if (( ${#items} )); then
    _describe -t majordomus 'candidate' items
  else
    _files
  fi
}
_majordomus_complete() { _majordomus_query cli }
_majordomus_workflow_complete() { _majordomus_query workflow }
compdef _majordomus_complete majordomus
compdef _majordomus_complete majordomus-cli
compdef _majordomus_workflow_complete just
"#;
Expand description

The zsh integration.

compdef is attached to the two spellings of this executable, to the shell tool, and to the workflow runner. The runner’s completion is the same function with a different surface, which is the whole of the “no second completion implementation” property: one query, one engine, one graph.