From 72194feae77870190471d220898e2ccf1c7443a5 Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Tue, 4 Apr 2023 08:42:23 -0400 Subject: New plugin args option Signed-off-by: Dave Henderson --- docs/content/config.md | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/content/config.md b/docs/content/config.md index 9e488e8a..dbdc5ce0 100644 --- a/docs/content/config.md +++ b/docs/content/config.md @@ -304,15 +304,19 @@ See [`--plugin`](../usage/#plugin). A map that configures custom functions for use in the templates. The key is the name of the function, and the value configures the plugin. The value is a map containing the command (`cmd`) and the options `pipe` (boolean) and `timeout` -(duration). +(duration). A list of optional arguments to always pass to the plugin can be set +with `args` (array of strings). -Alternatively, the value can be a string, which sets `cmd`. +Alternatively, the value can be a string, which sets only `cmd`. ```yaml -in: '{{ "hello world" | figlet | lolcat }}' +in: '{{ "world" | figlet | lolcat }}' plugins: figlet: cmd: /usr/local/bin/figlet + args: + - oh + - hello pipe: true timeout: 1s lolcat: /home/hairyhenderson/go/bin/lolcat @@ -322,6 +326,33 @@ plugins: The path to the plugin executable (or script) to run. +### `args` + +An array of optional arguments to always pass to the plugin. These arguments +will be passed _before_ any arguments provided in the template. + +For example: + +```yaml +plugins: + echo: + cmd: /bin/echo + args: + - foo + - bar +``` + +With this template: +``` +{{ echo "baz" }} +``` + +Will result the command being called like this: + +```console +$ /bin/echo foo bar baz +``` + ### `pipe` Whether to pipe the final argument of the template function to the plugin's -- cgit v1.2.3