add chlg, chcode warning for --watch w/o file

This commit is contained in:
2024-10-28 17:18:28 -05:00
parent 8742fd36a3
commit 417dafe751

View File

@@ -32,9 +32,23 @@ function gi() { curl -sL https://www.toptal.com/developers/gitignore/api/$@ ;}
function chcode() {
EDITOR="code --wait"
# If no arguments are provided, the chezmoi directory is opened
if [[ "$@" == *"--watch"* ]]; then
for arg in "$@"; do
if [[ ! $arg == -* ]]; then
chezmoi edit $@
return
fi
done
echo "--watch requires a file to be provided, directories aren't supported with watch mode"
fi
chezmoi edit $@
}
function chlg() {
lazygit --path ~/.local/share/chezmoi
}
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'