Shell Completion
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 .nuke/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 nuke --help
.
Configuration​
Add the following snippets to the configuration file of your shell:
- PowerShell
- Zsh
- Bash
- fish
Microsoft.PowerShell_profile.ps1
Register-ArgumentCompleter -Native -CommandName nuke -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
nuke :complete "$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
.zshrc
_nuke_zsh_complete()
{
local completions=("$(nuke :complete "$words")")
reply=( "${(ps:\n:)completions}" )
}
compctl -K _nuke_zsh_complete nuke
.bashrc
_nuke_bash_complete()
{
local word=${COMP_WORDS[COMP_CWORD]}
local completions="$(nuke :complete "${COMP_LINE}")"
COMPREPLY=( $(compgen -W "$completions" -- "$word") )
}
complete -f -F _nuke_bash_complete nuke
config.fish
complete -fc nuke --arguments '(nuke :complete (commandline -cp))'
Usage​
You can complete targets, parameters, and enumeration values by hitting the TAB key:
Use Space to pause/play, ⬅ and ⮕ to seek backward/forward, or F to fullscreen.