diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2019-07-13 16:43:34 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2019-07-13 16:43:34 +1200 |
commit | 0b833f971422d82c2c000751f1a62409ad859a50 (patch) | |
tree | d06eb3e50ce07f3080a381f0570e9693f70b017d /bin/td.sh | |
parent | Merge branch 'release/v6.55.0' (diff) | |
parent | Bump VERSION (diff) | |
download | dotfiles-0b833f971422d82c2c000751f1a62409ad859a50.tar.gz dotfiles-0b833f971422d82c2c000751f1a62409ad859a50.zip |
Merge branch 'release/v6.56.0'v6.56.0
* release/v6.56.0:
Reduce GnuPG config considerably
Name my i3 workspaces
Update paste_insert.vim to v1.0.1
Extend td(1df) to edit multiple files
Diffstat (limited to 'bin/td.sh')
-rw-r--r-- | bin/td.sh | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -2,7 +2,6 @@ # Specify the path and file dir=${TODO_DIR:-"$HOME"/Todo} -file=${1:-"${TODO_NAME:-todo}"} # If the directory doesn't exist, create it [ -d "$dir" ] || mkdir -p -- "$dir" || exit @@ -17,15 +16,16 @@ if ! command -v isgr >/dev/null 2>&1 ; then fi isgr || git init --quiet || exit -# If the to-do file doesn't exist yet, create it -[ -e "$file" ] || touch -- "$file" || exit +if [ "$#" -eq 0 ] ; then + set -- "${TODO_NAME:-todo}" +fi -# Launch an appropriate editor to edit that file -"${VISUAL:-"${EDITOR:-ed}"}" "$file" +# Launch an appropriate editor to edit those files +"${VISUAL:-"${EDITOR:-ed}"}" "$@" -# Add the file to the changeset -git add -- "$file" +# Add those files to the changeset +git add -- "$@" -# If there are changes to commit, commit them -git diff-index --quiet HEAD 2>/dev/null || +# If there are changes to those files to commit, commit them +git diff-index --quiet HEAD "$@" 2>/dev/null || git commit --message 'Changed by td(1df)' --quiet |