Skip to main content
Version: 1.6

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:

  1. 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 running wf 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:

  1. 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:

  1. Run the CLI command:

    wf profiles list

    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:

  1. Run the CLI command:

    wf profiles use PROFILE-NAME

To apply a command once to a different profile:

  1. 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:

  1. Run the command:

    wf use workspace WORKSPACE-NAME

To apply a command to another workspace:

  1. Append -w WORKSPACE-NAME to any command.

    This applies the command to a workspace other than your default one.

To list your default workspace:

  1. 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:

  1. Ensure you have bash autocomplete installed (for example, on Fedora or CentOS linux)

    $ dnf install bash-completion
  2. 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:

  1. If shell completion is not already enabled in your environment, enable it by running the following once:


    $ echo "autoload -U compinit; compinit" >> ~/.zshrc
  2. To load completions for all sessions, run the following once:

    $ wf completion zsh > "${fpath[1]}/_wf"
  3. Start a new shell for this setup to take effect.