diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2019-10-15 23:03:21 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2019-10-22 21:28:01 -0400 |
| commit | d8257b605db77d1bb5246f08253f39dabe8cabd0 (patch) | |
| tree | f9910802680471b5e87e96871fc2664e2e618ea8 /docs | |
| parent | 8b71e0c890a422e14b1ba12f02f01427a7710d66 (diff) | |
Plugins for custom functions
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/content/usage.md | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/docs/content/usage.md b/docs/content/usage.md index 55b5fed9..22905859 100644 --- a/docs/content/usage.md +++ b/docs/content/usage.md @@ -207,6 +207,31 @@ A few different forms are valid: here are the contents of the template: [ hello, world! ] ``` +### `--plugin` + +Some specialized use cases may need functionality that gomplate isn't capable +of on its own. If you have a command or script to perform this functionality, +you can plug in your own custom functions with the `--plugin` flag: + +```console +$ gomplate --plugin echo=/bin/echo -i 'Hello {{ echo "World" }}' +Hello World +``` + +All arguments provided to the function will be passed through to the plugin, and +the plugin's standard output stream will be printed to the rendered output. + +If the plugin exits with a non-zero exit code, gomplate will also fail. All signals +caught by gomplate will be passed through to the plugin. Any output on the standard +error stream will be printed to gomplate's standard error stream. + +Plugins can also be written as PowerShell or CMD scripts (`.ps1`, `.bat`, or `.cmd` +extensions) on Windows. + +By default, plugins will time out after 5 seconds. To adjust this, set the +`GOMPLATE_PLUGIN_TIMEOUT` environment variable to a valid [duration](../functions/time/#time-parseduration) +such as `10s` or `3m`. + ## Post-template command execution Gomplate can launch other commands when template execution is successful. Simply |
