Skip to content

Commit

Permalink
Fix issue with flags when a switch value is enclosed in quotes
Browse files Browse the repository at this point in the history
When a flag's value is enclosed in quotes, the command was breaking due
to lack of an escape sequence. The issue has been fixed.
  • Loading branch information
surajp committed Sep 24, 2021
1 parent 9bea430 commit 4d5090a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fzf-key-bindings.bash
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ __fzf_sfdx_flags__(){
local selected="$1"
local fullcmd=""
for i in "${@:2}"
do fullcmd+=" $i"
do fullcmd+=" ${i//\"/\\\\\\\"}" #we have to triple escape the double quotes here as it will be used within double quotes again in the command below
done
local ret=`cat ~/.sfdxcommands.json | jq -r ".[] | select(.id==\"$selected\") | .flags | keys[]" | $(__fzfcmd) -m --bind 'ctrl-z:ignore,alt-j:preview-down,alt-k:preview-up' --preview='cat ~/.sfdxcommands.json | jq -r ".[] | select(.id==\"'$selected'\") | .flags | to_entries[] | select (.key==\""{}"\") | [\"Command:\n'"$fullcmd"'\n\",\"Flag Description:\",.value][]"' --preview-window='right:wrap'`
echo "${ret//$'\n'/ --}"
Expand Down
2 changes: 1 addition & 1 deletion fzf-key-bindings.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ __fzf_sfdx_flags(){
local selected="$1"
local fullcmd=""
for i in "${@:2}"
do fullcmd+=" $i"
do fullcmd+=" ${i//\"/\\\\\\\"}" #we have to triple escape the double quotes here as it will be used within double quotes again in the command below
done
local ret=`cat ~/.sfdxcommands.json | jq -r ".[] | select(.id==\"$selected\") | .flags | keys[]" | $(__fzfcmd) -m --bind='ctrl-z:ignore,alt-j:preview-down,alt-k:preview-up' --preview='cat ~/.sfdxcommands.json | jq -r ".[] | select(.id==\"'$selected'\") | .flags | to_entries[] | select (.key==\""{}"\") | [\"Command:\n'"$fullcmd"'\n\",\"Flag Description:\",.value][]"' --preview-window='right:wrap'`
echo "${ret//$'\n'/ --}"
Expand Down

0 comments on commit 4d5090a

Please sign in to comment.