clack
clack copied to clipboard
Using clack with bash to run command for each object in array
trafficstars
Hi @clumsyjedi how to Using clack with bash to run command for each object in array?
example: $ cat x.json | clack -i js :str-lists [ "a" "b" "c" ]
This works fine.
$ cat x.json | clack -i js :str-lists | CMD item
I want the last command to be run with iterate . Is there any possible way?
In addition, it would be nice if there was a way to create multiple lines of text.
Thanks.
Assuming I understand your questions you can try:
echo '[1,2,3]' | clack -u -i js
which would give you :
1
2
3
For raw strings try:
echo '["foo", "bar", "baz"]' | clack -u -i js -o s
The -u flag means "unwrap" arrays
The -o s flag outputs raw strings, so on a string this removes the '"' chars
I did as you told me, When bb was mixed, pipe args and bb args could be input separately. it's awesome Nice! Thanks~