Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
XBOX Docs are now on docs.xbox.com! This page is kept as an archive and is no longer being updated. Visit our documentation on docs.xbox.com for the latest information and updates.
Print a shell completion script, so pressing Tab completes xbox commands, options, and
values from a fixed list.
xbox completion <shell>
<shell> is bash, zsh, fish, or powershell. The command writes the script to stdout
and exits 0. It makes no network request and doesn't need you to sign in. It doesn't accept
--output table.
What completes
- Commands and subcommands at every depth, such as
playtoplayfaborplaytest. - The options a command takes, including the global ones.
- Values from a fixed list, such as
--outputformats,--supported-devicevalues, the--scopevalues ofxbl configcommands, the--viewvalues ofxbl config download, and the keyscontext setandcontext unsettake.
Completion doesn't look up resources such as playtests, sandboxes, or builds, or the profiles you saved, so those are still typed.
Enable completion
Add the line for your shell to its startup file, then open a new terminal. To try it in the current terminal first, run the same line there.
Bash, in ~/.bashrc:
eval "$(xbox completion bash)"
Zsh, in ~/.zshrc, after compinit runs:
source <(xbox completion zsh)
fish, in ~/.config/fish/config.fish:
xbox completion fish | source
PowerShell, in the file $PROFILE names:
xbox completion powershell | Out-String | Invoke-Expression
The script completes the command named xbox, so the CLI must be on PATH under that name.
How it works
Each script asks the CLI for candidates whenever you press Tab, by running xbox with the
command line typed so far. The CLI answers from its own command tree. It doesn't read
configuration or saved context, sign you in, send telemetry, or write anything.