2
0
mirror of https://github.com/kazhala/dotbare synced 2024-11-02 09:40:27 +00:00
dotbare/scripts/fstash

43 lines
788 B
Plaintext
Raw Normal View History

2020-04-30 23:44:57 +00:00
#!/bin/bash
#
# stash operation using fzf
#
# @params
# Globals
# None
# Arguments
# None
set -e
set -f
mydir="${0%/*}"
source "${mydir}"/../helper/set_variable.sh
source "${mydir}"/../helper/get_confirmation.sh
source "${mydir}"/../helper/git_query.sh
function usage() {
echo -e "Usage: dotbare fstash [-h] [-a] [-b] [-c] ...\n"
echo -e "save/apply stash using fzf\n"
echo -e "optional arguments:"
echo -e " -h\t\tshow this help message and exit"
}
stash_file=""
while getopts ":hf" opt; do
case "$opt" in
f)
stash_file='true'
;;
h)
usage
exit 0
;;
esac
done
selected_stash=$(get_stash)
2020-05-01 02:22:54 +00:00
[[ -z "${selected_stash}" ]] && exit 1
/usr/bin/git --git-dir="${DOTBARE_DIR}" --work-tree="${DOTBARE_TREE}" stash apply ${selected_stash}