Add stv and ishelp to shell_aliases

Fix pushdot and getdot functions
This commit is contained in:
Sage Vaillancourt 2023-12-13 15:00:04 -05:00
parent 94ffef797d
commit b8f38ee429
2 changed files with 22 additions and 2 deletions

View File

@ -1,5 +1,23 @@
#!/bin/bash
function ishelp {
[[ "$1" == "help" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]
}
function stv {
local stash=0
if ishelp $1; then
echo "Show the diff for the given stash. Default to 0"
return
fi
if [[ "${1:0:1}" == "^" ]]; then
stash=${#1}
elif [[ "$1" != "" ]]; then
stash="$1"
fi
git stash show -p stash@{$stash}
}
function hearch {
history 0 | sed 's/[0-9 ]*//' | grep "$@"
}

View File

@ -1,3 +1,5 @@
export SCRIPT_DIR="${0:A:h}"
if test -f /usr/share/doc/fzf/examples/completion.zsh &> /dev/null; then
source /usr/share/doc/fzf/examples/completion.zsh
fi
@ -65,7 +67,7 @@ if [ "$TERM" = "linux" ]; then
fi
function pushdot {
cd ~/.dotfiles &&
cd "$SCRIPT_DIR" || return 1
if [ $# -eq 0 ]; then
git commit -a && git push -u origin master &
else
@ -75,7 +77,7 @@ function pushdot {
}
function getdot {
cd ~/.dotfiles &&
cd "$SCRIPT_DIR" || return 1
git pull
cd -
}