Using the Wayfinder CLI
You can interact with Wayfinder using either the UI or the Wayfinder CLI. Both of these offer similar capabilities, and you can accomplish most tasks through either interface.
If you do not already have the CLI, follow the steps in Get the CLI.
To find help for any command, run wf help COMMAND
or browse the
CLI reference.
tip
Familiar with kubectl
? The Wayfinder CLI follows a similar pattern. Everything is a resource that you
can list, get, create, update or delete. These resources are grouped by workspace, like namespaces
in kubectl
.
Log in to Wayfinder​
To log in for the first time:
Run the CLI command
wf login
, with the URL of the Wayfinder instance you wish to connect to.This example logs you in while creating a profile called
wayfinder-prod
. Once logged in, you can re-authenticate at any time by runningwf login
with no parameters.# Log in to Wayfinder at the specified API URL and create a new profile
# for it named wayfinder-prod:
wf login wayfinder-prod -a https://api.wayfinder-prod.myorg.io
note
If you need a non-interactive login for your CI system to access Wayfinder, you can create a robot token. See Robot Roles.
Find the Wayfinder version​
To find the Wayfinder version:
Run the CLI command
wf --profile PROFILE-NAME serverinfo
.For example:
wf --profile qatest serverinfo
VERSION SHA
v1.4.2 92d70eb6d
View profiles​
Wayfinder CLI supports profiles, which are similar to kubectl contexts. Profiles let you connect to multiple
instances of Wayfinder, or use different users or authentication methods. The example login command
above creates your first profile wayfinder-prod
.
To list your profiles and see which one is currently active:
Run the CLI command:
For example:
$ wf profiles list
PROFILE ENDPOINT DEFAULT WORKSPACE ACTIVE
wf-notprod https://api.staging.wf.yourorg.io None -
wayfinder-prod https://api.wf.yourorg.io devs - y
To choose a different active profile:
Run the CLI command:
To apply a command once to a different profile:
Append
--profile PROFILE-NAME
to any Wayfinder command. For example:wf create user --profile wf-notprod
This creates a user using the
wf-notprod
profile, while keeping your current profile (wayfinder-prod
) active.
Set a default workspace​
Almost all commands in the Wayfinder CLI are oriented around workspaces.
To set a default workspace in your current profile:
Run the command:
To apply a command to another workspace:
Append
-w WORKSPACE-NAME
to any command.This applies the command to a workspace other than your default one.
To list your default workspace:
Run the command:
wf profiles list
Make life easier with auto-completion​
If you want to save keystrokes and get commands, arguments, and options completed for you, install the Wayfinder CLI autocompletion in your shell.
Bash autocompletion​
To use bash autocompletion:
Ensure you have bash autocomplete installed (for example, on Fedora or CentOS linux)
$ dnf install bash-completion
Source in the bash autocompletion for the current terminal:
$ source <(wayfinder completion bash)
To load bash autocompletion when opening a new terminal, place
source <(wayfinder completion bash)
into your bash profile (${HOME}/.bash_profile
).
ZSH autocompletion​
To use ZSH autocompletion:
If shell completion is not already enabled in your environment, enable it by running the following once:
$ echo "autoload -U compinit; compinit" >> ~/.zshrcTo load completions for all sessions, run the following once:
$ wf completion zsh > "${fpath[1]}/_wf"
Start a new shell for this setup to take effect.