mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-19 09:03:43 -05:00
use arrays instead of piping to head and tail in fstash
14
Examples.md
14
Examples.md
@@ -343,13 +343,15 @@ fstash() {
|
|||||||
fzf --ansi --no-sort --query="$q" --print-query \
|
fzf --ansi --no-sort --query="$q" --print-query \
|
||||||
--expect=ctrl-d,ctrl-b);
|
--expect=ctrl-d,ctrl-b);
|
||||||
do
|
do
|
||||||
q=$(head -1 <<< "$out")
|
mapfile -t out <<< "$out"
|
||||||
k=$(head -2 <<< "$out" | tail -1)
|
q="${out[0]}"
|
||||||
sha=$(tail -1 <<< "$out" | cut -d' ' -f1)
|
k="${out[1]}"
|
||||||
[ -z "$sha" ] && continue
|
sha="${out[-1]}"
|
||||||
if [ "$k" = 'ctrl-d' ]; then
|
sha="${sha%% *}"
|
||||||
|
[[ -z "$sha" ]] && continue
|
||||||
|
if [[ "$k" = 'ctrl-d' ]]; then
|
||||||
git diff $sha
|
git diff $sha
|
||||||
elif [ "$k" = 'ctrl-b' ]; then
|
elif [[ "$k" = 'ctrl-b' ]]; then
|
||||||
git stash branch "stash-$sha" $sha
|
git stash branch "stash-$sha" $sha
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user