Skip to content

tfcensus completion ​

Generate the autocompletion script for tfcensus for the specified shell. See each sub-command's help for details on how to use the generated script.

Usage ​

sh
tfcensus completion <shell>

Shells ​

ShellCommand
bashtfcensus completion bash
clinktfcensus completion clink
elvishtfcensus completion elvish
fishtfcensus completion fish
nushelltfcensus completion nushell
oiltfcensus completion oil
powershelltfcensus completion powershell
tcshtfcensus completion tcsh
xonshtfcensus completion xonsh
zshtfcensus completion zsh

The global flags work with every command. The shell commands ignore --format.

bash ​

Generate the autocompletion script for the bash shell.

This script depends on the 'bash-completion' package. If it is not installed already, you can install it via your OS's package manager.

To load completions in your current shell session:

text
source <(tfcensus completion bash)

To load completions for every new session, execute once:

Linux

text
tfcensus completion bash > /etc/bash_completion.d/tfcensus

macOS

text
tfcensus completion bash > $(brew --prefix)/etc/bash_completion.d/tfcensus

You will need to start a new shell for this setup to take effect.

FlagDescriptionTypeDefaultValuesConfig keyNotes
--no-descriptionsdisable completion descriptionsbool

Generate the autocompletion script for clink. carapace, built into tfcensus, writes it.

Save the script as a Lua file in a clink scripts directory, such as %LOCALAPPDATA%\clink\tfcensus.lua:

text
tfcensus completion clink > %LOCALAPPDATA%\clink\tfcensus.lua

elvish ​

Generate the autocompletion script for elvish. carapace, built into tfcensus, writes it.

Add this line to ~/.config/elvish/rc.elv:

text
eval (tfcensus completion elvish | slurp)

fish ​

Generate the autocompletion script for the fish shell.

To load completions in your current shell session:

text
tfcensus completion fish | source

To load completions for every new session, execute once:

text
tfcensus completion fish > ~/.config/fish/completions/tfcensus.fish

You will need to start a new shell for this setup to take effect.

FlagDescriptionTypeDefaultValuesConfig keyNotes
--no-descriptionsdisable completion descriptionsbool

nushell ​

Generate the autocompletion script for nushell. carapace, built into tfcensus, writes it.

The script defines $tfcensus_completer. Save it, source it from config.nu and use it as the external completer (or call it from yours when the first span is tfcensus):

text
tfcensus completion nushell | save --force ~/.config/nushell/tfcensus.nu

# config.nu
source ~/.config/nushell/tfcensus.nu
$env.config.completions.external = {enable: true, completer: $tfcensus_completer}

oil ​

Generate the autocompletion script for oil. carapace, built into tfcensus, writes it.

Add this line to your oils startup file (~/.config/oils/oshrc or yshrc):

text
source <(tfcensus completion oil)

powershell ​

Generate the autocompletion script for powershell.

To load completions in your current shell session:

text
tfcensus completion powershell | Out-String | Invoke-Expression

To load completions for every new session, add the output of the above command to your powershell profile.

FlagDescriptionTypeDefaultValuesConfig keyNotes
--no-descriptionsdisable completion descriptionsbool

tcsh ​

Generate the autocompletion script for tcsh. carapace, built into tfcensus, writes it.

Add this line to ~/.tcshrc:

text
eval `tfcensus completion tcsh`

xonsh ​

Generate the autocompletion script for xonsh. carapace, built into tfcensus, writes it.

Add this line to ~/.xonshrc:

text
exec($(tfcensus completion xonsh))

zsh ​

Generate the autocompletion script for the zsh shell.

If shell completion is not already enabled in your environment you will need to enable it. You can execute the following once:

text
echo "autoload -U compinit; compinit" >> ~/.zshrc

To load completions in your current shell session:

text
source <(tfcensus completion zsh)

To load completions for every new session, execute once:

Linux

text
tfcensus completion zsh > "${fpath[1]}/_tfcensus"

macOS

text
tfcensus completion zsh > $(brew --prefix)/share/zsh/site-functions/_tfcensus

You will need to start a new shell for this setup to take effect.

FlagDescriptionTypeDefaultValuesConfig keyNotes
--no-descriptionsdisable completion descriptionsbool

Exit codes ​

CodeMeaning
0The command finished. With --fail-on, nothing matched.
1The command failed: a read, a write, a child process or a check failed.
2Wrong usage: an unknown command or flag, a bad value or argument, an invalid config file, or a prompt with no terminal.
130Interrupted by Ctrl-C (SIGINT) or a cancelled context.

All codes are listed on the exit codes page.

Examples ​

sh
tfcensus completion bash > /etc/bash_completion.d/tfcensus
tfcensus completion zsh > "${fpath[1]}/_tfcensus"
tfcensus completion fish > ~/.config/fish/completions/tfcensus.fish