Skip to content

VIP-CLI

Basic usage

Available VIP-CLI commands and their options can be reviewed by running vip --help (or -h):

$ vip -h
  Usage: vip [options] [command]

  Commands:
    app             List and modify your VIP applications
    config          Set configuration for your VIP applications
    dev-env         Use local dev-environment
    import          Import media or SQL files into your VIP applications
    logout          Logout from your current session
    logs            Get logs from your VIP applications
    search-replace  Perform search and replace tasks on files
    sync            Sync production to a development environment
    whoami          Display details about the currently logged-in user
    wp              Run WP CLI commands against an environment

  Options:
    -d, --debug    Activate debug output
    -h, --help     Output the help for the (sub)command
    -v, --version  Output the version number

A help menu for individual commands can be viewed by running: vip [command] -h

For example, to view the options and more information about the vip config command:

$ vip config -h
  Usage: vip config [options] [command]

  Commands:
    envvar  Manage environment variables for an application environment

  Options:
    -d, --debug    Activate debug output
    -h, --help     Output the help for the (sub)command
    -v, --version  Output the version number

VIP-CLI commands

To run a VIP-CLI command against an application’s environment, a user must have an App write role or greater for that application.

A VIP-CLI command can only be run against one environment at a time, so both an application and one of its environments must be specified in a VIP-CLI command.

An environment can be targeted in a VIP-CLI command by including the application’s alias, a dot separator, and the target environment type: @<app-alias>.<env>

For example, to target the preprod environment for an application with the alias mytestsite:

$ vip @mytestsite.preprod sync
===================================
+ App: mytestsite (id: 4323)
+ Environment: preprod (id: 4354)
+ Replacements: 
┌─────────────────────────┬─────────────────────────────────┐
│ from                    │ to                              │
├─────────────────────────┼─────────────────────────────────┤
│ //mytestsite.go-vip.net │ //mytestsite-preprod.go-vip.net │
└─────────────────────────┴─────────────────────────────────┘
===================================
? Are you sure you want to sync from production? (y/N) › false

WP-CLI commands

Running WP-CLI commands with VIP-CLI requires a double dash (--) separating the arguments of the vip command from those of the wp command. The double dash must be included to avoid unexpected issues due to parameter conflicts.

For example, to retrieve the list of WordPress users from the preprod environment of the mytestsite application:

$ vip @mytestsite.preprod -- wp user list

Interactive shell

VIP-CLI includes an interactive shell mode that provides a terminal-like interface into a VIP WordPress site.

To enter the interactive shell mode, run the VIP-CLI command: vip @<app-alias>.<env> -- wp

WP-CLI commands can then be run without the vip @<app-alias>.<env> -- argument structure.

$ vip @mytestsite.preprod -- wp 
mytestsite.preprod:~$ wp option get home 
https://example.com  
mytestsite.preprod:~$ wp cache delete my-cache-key my-cache-group 
Success: Object deleted.
mytestsite.preprod:~$ 

Using the interactive shell mode is a convenient way to run multiple commands on the same environment and behaves much like a standard terminal or SSH session would. While the interactive shell looks and acts like a standard terminal, it does not currently support bash operators or commands (e.g. xargs, variable substitution, etc). Those commands need to be run in the standard VIP-CLI format.

Cancelling a command

WP-CLI commands that are still running can be cancelled by the user that initiated the command.

  • From the VIP-CLI terminal: Type the keyboard abort command Control + C.
  • From the VIP Dashboard: Navigate to the WP-CLI Commands panel. Select the “Cancel” option to the right of the Running command.

Last updated: April 29, 2022