Skip to main content

Command Line Interface (CLI)

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.


Use the CLI to log in to Wayfinder

To log in for the first time:

Wayfinder's web interface makes it easy for you to log into the CLI:

  • Click on the CLI button in the top right corner of your screen.
  • If you do not already have the CLI, you can follow step 1 and download the CLI. Use the drop-down menu to select your operating system. The download link will update accordingly.
  • Once you have installed the CLI, you can copy the link in step 2 to log in.
info

Wayfinder creates a default profile for you which is based on the Wayfinder instance installed. This means that you do not have to specify a profile when you log in.

If you do not have the Wayfinder web interface, then you can log into the CLI as follow:

  1. If you do not already have the CLI, follow the steps in Get the CLI.
  2. Run the CLI command wf login, with the URL of the Wayfinder instance you wish to connect to.

note

If you need a non-interactive login for your CI system to access Wayfinder, you can create an access token. See Access Tokens.


To find help for any command, run wf help COMMAND or browse the CLI reference.


Find the Wayfinder version

To find the Wayfinder version:

  1. Run the CLI command wf serverinfo.

    For example:

    wf serverinfo
    VERSION SHA
    v1.4.2 92d70eb6d

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.

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

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.