File tree Expand file tree Collapse file tree 4 files changed +65
-1
lines changed
Expand file tree Collapse file tree 4 files changed +65
-1
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # shellcheck disable=SC1091 # Not following: ./__assertgitrepo was not specified as input
4+ # shellcheck disable=SC2155 # Declare and assign separately to avoid masking return values
5+ # shellcheck disable=SC2001 # See if you can use ${variable//search/replace}
6+
7+ source " ${__CUSTOM_GIT_UTIL} " /fzf_headers/__gstash_header
8+ source " ${__CUSTOM_GIT_UTIL} " /__assertgitrepo
9+
10+ __assertgitrepo
11+
12+ function main() {
13+
14+ local GSTASH_HEADER=" $( __gstash_header) "
15+
16+ local selectedStr=" $( git stash list | \
17+ fzf --bind ' ?:toggle-preview' \
18+ --header " ${GSTASH_HEADER} " \
19+ --preview " source ${__CUSTOM_GIT_UTIL} /fzf_previews/__gstash_preview; __gstash_preview {}" ) "
20+ [ -z " ${selectedStr} " ] && return
21+
22+ local stashId=" $( echo " ${selectedStr} " | sed ' s/\:.*//g' ) "
23+ git stash apply " ${stashId} "
24+
25+ git status
26+ }
27+
28+ main
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # shellcheck disable=SC1091
4+ # shellcheck disable=SC2001
5+ # shellcheck disable=SC2155
6+
7+ source " $__CUSTOM_CONSOLE_UTIL " /__common
8+
9+ function __gstash_header() {
10+
11+ local msg=" gstashapply | enter: apply stash | ?: toggle preview"
12+ local colorMsgL1=" ${UNDERLINE}${MAGENTA} gstashapply${RESET} | \
13+ ${BLUE} enter:${RESET} apply stash | \
14+ ${BLUE} ?:${RESET} toggle preview"
15+ local colorMsgL2=" | ${BLUE} esc:${RESET} quit"
16+
17+ local edge=" $( echo " ${msg} " | sed -e ' s/./-/g' ) "
18+ local GSTASH_HEADER=" ${edge} " '
19+ ' " ${colorMsgL1} " '
20+ ' " ${colorMsgL2} " '
21+ ' " ${edge} " '
22+ '
23+
24+ echo " ${GSTASH_HEADER} "
25+ }
Original file line number Diff line number Diff line change 11#! /bin/bash
22
33# shellcheck disable=SC2155
4- # shellcheck disable=SC1091 # Not following: ./__common was not specified as input (see shellcheck -x)
54
65function __gshow_preview() {
76
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # shellcheck disable=SC2155
4+ # shellcheck disable=SC2001 # See if you can use ${variable//search/replace}
5+
6+
7+ function __gstash_preview() {
8+
9+ local str=" ${1} "
10+ local stashId=" $( echo " $str " | sed ' s/\:.*//g' ) "
11+ git stash show -p --color=always " ${stashId} " | ${CUSTOM_GIT_PAGER}
12+ }
You can’t perform that action at this time.
0 commit comments