diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-06-14 13:57:25 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-06-14 13:57:25 +1200 |
commit | 1afa7209675a91875229fbe4ec07f84cbd45bac0 (patch) | |
tree | 23de16888a5c0e35cd86633bd70aa32c013f212b /bin | |
parent | Strip trailing newline (diff) | |
download | dotfiles-1afa7209675a91875229fbe4ec07f84cbd45bac0.tar.gz dotfiles-1afa7209675a91875229fbe4ec07f84cbd45bac0.zip |
Add per-file editing and completion for td(1)
I have "todo", "comp", and "writ".
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/td | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -1,7 +1,7 @@ #!/usr/bin/env bash # -# td(1) -- Manage a to-do file with just $EDITOR and git(1), because I've +# td(1) -- Manage to-do files with just $EDITOR and git(1), because I've # completely given up on finding a more useful way to do it. # # Author: Tom Ryder <tom@sanctum.geek.nz> @@ -10,11 +10,11 @@ # self=td -# Specify the path to the file; you can override this with a $TODO environment -# variable -path=${TODO:-$HOME/Todo/todo.markdown} -file=${path##*/} -dir=${path%/*} +# Specify the path to the file; you can override this with environment +# variables +dir=${TODO_DIR:-$HOME/Todo} +file=${1:-${TODO_NAME:-todo}} +path="$dir"/"$file" # Check we've got the tools we need hash git || exit @@ -44,9 +44,8 @@ if ! [[ -e $file ]] ; then touch -- "$file" || exit fi -# Launch $VISUAL (or $EDITOR (or vi(1))), with any arguments given as options, -# to edit the to-do file -"${VISUAL:-${EDITOR:-vi}}" "$@" "$file" +# Launch $VISUAL (or $EDITOR (or vi(1))) to edit the appropriate to-do file +"${VISUAL:-${EDITOR:-vi}}" "$file" # Add the file to the changeset git add -- "$file" |