rofi-blocks
rofi-blocks copied to clipboard
Escape format question
Hi,
Thanks for this nice tool. I am playing with action_logger.sh example, and it is hard to understand the quoting inside. or the "event_format" described in readme.md.
I used jq to feed json into the rofi-block. But it does not properly output the line.
How to set this code set proper quoting format?
{"name":"{{name_escaped}}", "value":"{{value_escaped}}"}
My script:
#!/bin/bash
ACTIONS=""
echo '{"input action":"send", "prompt":"updating input also logs action" }'
jsonfile=$(mktemp)
log_action(){
echo "$ACTIONS" | jq -c '{ lines: [.]} }' | tee $jsonfile 1>&2
cat $jsonfile
}
if IFS= read -r line; then
ACTIONS="$line"
log_action
fi
while IFS= read -r line; do
ACTIONS="$line"
log_action
done