summaryrefslogtreecommitdiff
path: root/docs-src
diff options
context:
space:
mode:
authorCharles Duffy <charles@dyfis.net>2019-08-25 22:16:19 -0500
committerDave Henderson <dhenderson@gmail.com>2019-08-25 23:16:19 -0400
commit571e136c954358a53dd1816134731611f584734b (patch)
treee3a8bba1cc4f19023c3d8f0b7a22ff0bb9e9eb75 /docs-src
parentf3e81831ebf7fb93106fa9cafc07467db4411524 (diff)
Implement shell-compatible quoting (#587)
* Implement shell-compatible quoting * Reorganize to move non-template-specific logic from funcs/strings to strings/strings
Diffstat (limited to 'docs-src')
-rw-r--r--docs-src/content/functions/strings.yml18
1 files changed, 18 insertions, 0 deletions
diff --git a/docs-src/content/functions/strings.yml b/docs-src/content/functions/strings.yml
index b3062dc4..e2532a17 100644
--- a/docs-src/content/functions/strings.yml
+++ b/docs-src/content/functions/strings.yml
@@ -252,6 +252,24 @@ funcs:
- |
$ echo 'Rock & Roll @ Cafe Wha?' | gomplate -d in=stdin: -i '{{ strings.Slug (include "in") }}'
rock-and-roll-at-cafe-wha
+ - name: strings.ShellQuote
+ alias: shellQuote
+ description: |
+ Given a string, emits a version of that string that will evaluate to its literal data when expanded by any POSIX-compliant shell.
+
+ Given an array or slice, emit a single string which will evaluate to a series of shell words, one per item in that array or slice.
+ pipeline: true
+ arguments:
+ - name: in
+ required: true
+ description: The input to quote
+ examples:
+ - |
+ $ gomplate -i "{{ slice \"one word\" \"foo='bar baz'\" | shellQuote }}"
+ 'one word' 'foo='"'"'bar baz'"'"''
+ - |
+ $ gomplate -i "{{ strings.ShellQuote \"it's a banana\" }}"
+ 'it'"'"'s a banana'
- name: strings.Squote
alias: squote
description: |