zsh: added more usage info to todo()

This commit is contained in:
PowerUser64 2021-09-19 16:35:29 -07:00
parent f20b8a6421
commit 2aabf6bb5d

18
.zshrc
View file

@ -154,12 +154,16 @@
done done
} }
# an improved way to manage the todo list # a simple way to manage your todo list
# Usage: # Usage:
# todo -- edit ~/todo # todo -- edit ~/todo
# todo auto -- commit ~/todo and push with message 'todo' # todo auto -- commit and push ~/todo with message 'todo'
# todo [git command string] -- manage todo for easy syncing, assuming ~/todo is # todo [any git command] -- manage todo for easy syncing, assuming ~/todo is
# a symlink that points to a file in a git repo # a symlink that points to a file in a git repo
#
# Suggested use: make a git repo for holding your todo list, then make
# a symlink called 'todo' that points to your todo list in your home directory
#
todo() { todo() {
( # subshell to protect against directory changes ( # subshell to protect against directory changes
todo_dir="$(dirname "$(realpath ~/todo)")" todo_dir="$(dirname "$(realpath ~/todo)")"
@ -168,7 +172,8 @@
$EDITOR ~/todo $EDITOR ~/todo
elif [ "$@" = 'auto' ];then elif [ "$@" = 'auto' ];then
cd "$todo_dir" cd "$todo_dir"
git commit "$(realpath ~/todo)" -m 'todo' && todo push git commit "$(realpath ~/todo)" -m 'todo'
git push
else else
cd "$todo_dir" cd "$todo_dir"
git $@ git $@
@ -626,5 +631,6 @@ add-zsh-hook preexec mzc_termsupport_preexec
# Optionally source the user's customized .zshrc # Optionally source the user's customized .zshrc
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshrc.local" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshrc.local" || return 0 [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshrc.local" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshrc.local" || return 0
# vim:fdm=marker:fmr=>>>,<<<:et:ft=zsh:sw=3 # filetype is sh for language server
# vim:fdm=marker:fmr=>>>,<<<:et:ft=sh:sw=3