The idea of custom commands is that someone on a team defines a set of useful commands and stores them in the
devspace.yaml, then commits and pushes this config to the code repository. Now, others can run these custom commands without having to remember all the details or having to read through endless pages of documentation.
Custom commands are being shared in the
commands section of
Custom commands can be used for more than just running
devspace commands, e.g. they can run any other script or command, set environment variables etc. If you are familiar with the
scripts section of the
package.json for Node.js, you will find that
devspace run [name] works pretty much the same way as
npm run [name]
The above example configuration would allow everyone to run the custom command
debug-backend like this:
devspace run would execute the following command internally:
Custom commands proxy input and output streams, so you can even share interactive commands such as
name option is mandatory and expects a string with name that serves as an alias for the command provided in the
command option is mandatory and expects a string with an arbitrary terminal command.
While you can run any
devspace command, you can also run other commands (if installed), set environment variables or use
bash style expressions such as
;. To ensure that many of your team mates can run the command on any platform, it is highly recommended to keep your command expressions as simple as possible.
Write all commands in
bash style. DevSpace is using a library to make them cross-platform executable.
devspace list commands
Run this command to list all custom commands that are configured: