Command-line arguments

This details the arguments that the gw binary takes.

Positional arguments #

Every gw execution should specify a directory to a git repository. This will be the repository which the gw checks to see if there are any changes and run actions.

Flag arguments #

gw follows GNU argument conventions, so every short arguments start with - and long arguments start with --.

Basic flags #

To get information about gw or change the output settings (more verbose with -v or quieter with -q), you can use these flags:

Argument nameExampleNotes
-v, --verbose-v, -vvIncrease verbosity, can be set multiple times (-v debug, -vv tracing).
-q, --quiet-qOnly print error messages.
-V, --version--versionPrint the current version.
-h, --help--helpPrint this help.

Trigger flags #

Use these flags, to set the different modes to check for changes:

Argument nameExampleNotes
-d, --every-d 5m, -d 1h, -d 0sRefreshes the repo with this interval. (default: 1m)
--once--onceTry to pull only once. Useful for cronjobs.
--http--http localhost:1234, --http 127.0.0.1:4321Runs an HTTP server on the URL, which allows to trigger by calling it.

Check flags #

These flags change the way gw checks the git repository for changes:

You can also configure the authentication for the git repository:

For more information see Authentication.

Argument nameExampleNotes
--on--on push, --on tag, --on tag:v*The trigger on which to run (can be push, tag or tag:pattern). (default: push)
-i, --ssh-key-i ~/.ssh/test.id_rsaSet the path for an ssh-key to be used when pulling.
--git-username--git-username daniel7grantSet the username for git to be used when pulling with HTTPS.
--git-token--git-token 'ghp_jB3c5...'Set the token for git to be used when pulling with HTTPS.
--git-known-host--git-known-host 'example.com ssh-rsa AAAAB3NzaC...'Add this line to the known_hosts file to be created (e.g. "example.com ssh-ed25519 AAAAC3...").

Action flags #

These flags configure the actions that should be run when the changes occur. These come in two flavours lowercase letters indicate that it is run directly, while uppercase letters will run in a subshell (e.g. /bin/sh on Linux). This is useful if you want to expand variables, pipe commands etc. It is recommended to always use single-quotes for the argument values to avoid accidental shell issues (e.g. expanding variables at start time).

You can also configure the process running:

For more information see Actions on pull.

Argument nameExampleNotes
-s, --script-s 'cat FILENAME'A script to run on changes, you can define multiple times.
-SRun a script in a shell.
-p, --processA background process that will be restarted on change.
-PRun a background process in a shell.
--process-retriesThe number of times to retry the background process in case it fails. By default 0 for no retries.
--stop-signalThe stop signal to give the background process. Useful for graceful shutdowns. By default SIGINT. (Only supported on *NIX)
--stop-timeoutThe timeout to wait before killing for the background process to shutdown gracefully. By default 10s.