Skip to content

Commit

Permalink
Merge pull request #2 from surajp/zsh-support
Browse files Browse the repository at this point in the history
Fix issue with flags when a switch value is enclosed in quotes
  • Loading branch information
surajp authored Sep 24, 2021
2 parents 92162d4 + 4d5090a commit c80003e
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 c80003e

Please sign in to comment.