Shell Completion
import AsciinemaPlayer from '@site/src/components/AsciinemaPlayer';
Typing long target names or parameters can be tedious and error-prone. The global tool helps you to invoke commands more quickly and without any typos, similar to tab completion for the .NET CLI.
info
The shell completion feature relies on the presence of an up-to-date .fallout/build.schema.json file. This file is updated with every execution of your build project.
Whenever you add or change one of your targets or parameters, it is recommended to trigger your build once, for instance by calling fallout --help.
Configuration
Add the following snippets to the configuration file of your shell:
Microsoft.PowerShell_profile.ps1
Register-ArgumentCompleter -Native -CommandName fallout -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
fallout :complete "$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
.zshrc
_fallout_zsh_complete()
{
local completions=("$(fallout :complete "$words")")
reply=( "${(ps:\n:)completions}" )
}
compctl -K _fallout_zsh_complete fallout
.bashrc
_fallout_bash_complete()
{
local word=${COMP_WORDS[COMP_CWORD]}
local completions="$(fallout :complete "${COMP_LINE}")"
COMPREPLY=( $(compgen -W "$completions" -- "$word") )
}
complete -f -F _fallout_bash_complete fallout
config.fish
complete -fc fallout --arguments '(fallout :complete (commandline -cp))'
Usage
You can complete targets, parameters, and enumeration values by hitting the TAB key: