Repository navigation
v1.1.0
Hephaestus v1.1.0
Shell completion, for Hephaestus itself and for the formulae it generates.
A minor release: it adds a command and a configuration key, as the
compatibility policy
allows in 1.x.0.
Hephaestus completes itself
hephaestus completion bash|zsh|fish prints a completion script for bash
(3.2 or later), zsh and fish. It completes:
- commands;
- each command's flags, in
--flagor-flagform. A flag already given
is not offered again, unless it can be repeated. - the fixed values of
--format,--template,--phase,--stagesand
--skip, as--flag valueor--flag=value. Comma-separated lists
continue after a comma. - file names for
--config,--reportand--output.
Candidates come from the same flag definitions the commands parse, so
completion offers only what Hephaestus accepts. Generating them reads no
configuration, token or repository and uses no network.
Homebrew users get the completions with this release. The formula
installs the three scripts into Homebrew's completion directories, on a new
install and on brew upgrade from 1.0.0:
etc/bash_completion.d/hephaestusshare/zsh/site-functions/_hephaestusshare/fish/vendor_completions.d/hephaestus.fish
Homebrew installs the files, but each shell must also be set up to load
them. A fish installed by Homebrew needs nothing more. bash needs
bash-completion@2, and zsh needs Homebrew's site-functions on FPATH
before compinit. The
README
has the lines to add, and the commands for installing without Homebrew.
Completions in the formulae Hephaestus generates
brews[].completions installs bash, zsh and fish completions with a
formula, whatever language the CLI is written in. There are two ways to
provide them, and they can be combined for different shells:
- Generated: the installed executable prints each script at install
time, through Homebrew'sgenerate_completions_from_executable. You set
the arguments (args, e.g.[completion]), how the shell is passed
(shell_parameter_format:arg,flag,none,cobra,clap,
clickortyper) and the shells. - Shipped: the scripts are included in the archive (
files) and
installed withbash_completion.install,zsh_completion.installand
fish_completion.installunder the names Homebrew expects.
brews:
- name: mycli
completions:
generate:
args: [completion]The configuration is checked before anything is published:
- the shell names and the format are valid;
- the executable is installed into
binfor every archive; - no shell's completion is installed twice;
- every shipped file exists in each archive.
Every value is written as a Ruby string literal. A formula without
completions is generated exactly as before. Details are in the
configuration reference.
Testing
- Real shells: bash 5 and macOS's bash 3.2, zsh (through its completion
system, in a pseudo-terminal) and fish, on Linux and macOS in CI. The
cases cover commands, flags, values,--flag=value, comma lists, file
names, a quoted value with a space, an already given flag,--and an
invalid shell. - Homebrew, with a shell-script fixture whose bash and zsh completions
are generated and whose fish completion is shipped:brew style,
brew audit --strict, install, the three files in place, completion in
the three shells,brew test, uninstall. - Homebrew, upgrading Hephaestus itself: v1.0.0 is installed from the
production tap's formula, then upgraded withbrew upgradeto a formula
generated from this release'shephaestus.yaml. The three completion
files appear and matchhephaestus completion, completion works in the
three shells with the installed binary, andbrew testand uninstall
pass.
Compatibility
- Additions only: the
completioncommand and thebrews[].completions
key. No existing command, flag, configuration key, Action input or
output, JSON field or check ID changed.hephaestus helplists two more
commands (completion,help). - A configuration that uses
brews[].completionsis rejected by
Hephaestus 1.0.0 and older, because unknown keys are errors.
Limitations
- Tags, repositories and other free-form values are not completed.
- PowerShell completion is not provided.
generateinstalls only bash,
zsh and fish, including withshell_parameter_format: cobraortyper,
whose Homebrew default would add PowerShell. - A custom
shell_parameter_formatprefix string is not supported; use
extra_installfor such a case.
Full Changelog: v1.0.0...v1.1.0