-
Notifications
You must be signed in to change notification settings - Fork 14
/
demo.sh
executable file
·31 lines (16 loc) · 1.03 KB
/
demo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# (cd ../cmd/plaxsubst && go install)
set -v
echo '{"deliver":"{?want}"}' | plaxsubst -p '?want="tacos"'
echo 'I like {?want|text}.' | plaxsubst -p '?want="tacos"'
echo '{"deliver":"{?want}"}' | plaxsubst -p '?want=["tacos","chips"]'
echo '{"deliver":["beer","{?want|json$}"]}' | plaxsubst -p '?want=["tacos","chips"]'
echo '{"deliver":"{?want}","n":{?want | js $.length | json}}' | plaxsubst -p '?want=["tacos","chips"]'
echo '{"deliver":"{?want | jq .[0] | json}"}' | plaxsubst -p '?want=["tacos","chips"]'
echo 'The order: {?want|text$}.' | plaxsubst -p '?want=["tacos","chips"]'
echo 'The first item: {?want|jq .[0]|text}.' | plaxsubst -p '?want=["tacos","chips"]'
echo '{"deliver":{"chips":2,"":"{?want|json@}"}}' |
plaxsubst -p '?want={"tacos":2,"salsa":1}' -check-json-in -check-json-out
echo 'I want <?want|text>.' | plaxsubst -d "<>" -p '?want="tacos"'
echo '{"deliver":"?want"}' | plaxsubst -bind -p '?want={"tacos":3}'
echo '{"deliver":"?want | jq .[0]"}' | plaxsubst -bind -p '?want=[{"tacos":3},{"queso":1}]'