Skip to content

Custom Commands

Voltig CLI allows you to define your own custom commands in the voltig.yml configuration file. This makes it easy to automate build, test, deployment, and other project-specific tasks.

Custom commands are defined under the commands section in your voltig.yml file. Each command can have a summary, a shell command, a script, and optional arguments.

commands:
build:
summary: Build the project
command: go build -o voltig .
test:
summary: Run tests
command: go test ./...
setup-dev:
summary: Run setup script
script: ./scripts/setup-dev.sh
deploy:
summary: Deploy with arguments
script: ./scripts/deploy.sh
args:
- "--prod"
  • summary: Short description of the command.
  • command: Shell command to execute (runs in your shell).
  • script: Path to a script file to run.
  • args: List of arguments to pass to the script.

💡 Tip: You can use both command and script fields, but typically only one is needed per command.

To run a custom command, use:

Terminal window
voltig <command-name>

For example, to run the build command:

Terminal window
voltig build
  • Use descriptive summaries for each command.
  • Group related scripts and commands for clarity.
  • Use arguments to make commands flexible.
  • Store scripts in a scripts/ directory for organization.

⚠️ Note: Ensure your scripts are executable (chmod +x script.sh) and paths are correct relative to your project root.