Merge branch 'gina/master'
This commit is contained in:
12
todo.actions.d/edit
Executable file
12
todo.actions.d/edit
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
case $1 in
|
||||||
|
"usage")
|
||||||
|
echo "$(basename $0) [BASENAME]"
|
||||||
|
echo " Open \$TODO_DIR/BASENAME.txt in \$EDITOR."
|
||||||
|
echo " If BASENAME is not given, defaults to 'todo'."
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
FILE=${2:-todo}.txt
|
||||||
|
$EDITOR $TODO_DIR/$FILE
|
||||||
|
;;
|
||||||
|
esac
|
||||||
8
todo.sh
8
todo.sh
@@ -164,6 +164,7 @@ help()
|
|||||||
TODOTXT_PLAIN=1 is same as option -p
|
TODOTXT_PLAIN=1 is same as option -p
|
||||||
TODOTXT_DATE_ON_ADD=1 is same as option -t
|
TODOTXT_DATE_ON_ADD=1 is same as option -t
|
||||||
TODOTXT_VERBOSE=1 is same as option -v
|
TODOTXT_VERBOSE=1 is same as option -v
|
||||||
|
TODOTXT_DEFAULT_ACTION="" run this when called with no arguments
|
||||||
EndHelp
|
EndHelp
|
||||||
|
|
||||||
if [ -d "$HOME/.todo.actions.d" ]
|
if [ -d "$HOME/.todo.actions.d" ]
|
||||||
@@ -301,6 +302,7 @@ TODOTXT_FORCE=${TODOTXT_FORCE:-0}
|
|||||||
TODOTXT_PRESERVE_LINE_NUMBERS=${TODOTXT_PRESERVE_LINE_NUMBERS:-1}
|
TODOTXT_PRESERVE_LINE_NUMBERS=${TODOTXT_PRESERVE_LINE_NUMBERS:-1}
|
||||||
TODOTXT_AUTO_ARCHIVE=${TODOTXT_AUTO_ARCHIVE:-1}
|
TODOTXT_AUTO_ARCHIVE=${TODOTXT_AUTO_ARCHIVE:-1}
|
||||||
TODOTXT_DATE_ON_ADD=${TODOTXT_DATE_ON_ADD:-0}
|
TODOTXT_DATE_ON_ADD=${TODOTXT_DATE_ON_ADD:-0}
|
||||||
|
TODOTXT_DEFAULT_ACTION=${TODOTXT_DEFAULT_ACTION:-}
|
||||||
|
|
||||||
[ -e "$TODOTXT_CFG_FILE" ] || {
|
[ -e "$TODOTXT_CFG_FILE" ] || {
|
||||||
CFG_FILE_ALT="$HOME/.todo.cfg"
|
CFG_FILE_ALT="$HOME/.todo.cfg"
|
||||||
@@ -321,7 +323,9 @@ export TODO_SH
|
|||||||
|
|
||||||
. "$TODOTXT_CFG_FILE"
|
. "$TODOTXT_CFG_FILE"
|
||||||
|
|
||||||
[ -z "$1" ] && usage
|
ACTION=${1:-$TODOTXT_DEFAULT_ACTION}
|
||||||
|
|
||||||
|
[ -z "$ACTION" ] && usage
|
||||||
[ -d "$TODO_DIR" ] || die "Fatal Error: $TODO_DIR is not a directory"
|
[ -d "$TODO_DIR" ] || die "Fatal Error: $TODO_DIR is not a directory"
|
||||||
( cd "$TODO_DIR" ) || die "Fatal Error: Unable to cd to $TODO_DIR"
|
( cd "$TODO_DIR" ) || die "Fatal Error: Unable to cd to $TODO_DIR"
|
||||||
|
|
||||||
@@ -442,7 +446,7 @@ _list() {
|
|||||||
export -f _list
|
export -f _list
|
||||||
|
|
||||||
# == HANDLE ACTION ==
|
# == HANDLE ACTION ==
|
||||||
action=$( printf "%s\n" "$1" | tr 'A-Z' 'a-z' )
|
action=$( printf "%s\n" "$ACTION" | tr 'A-Z' 'a-z' )
|
||||||
|
|
||||||
## If the first argument is "command", run the rest of the arguments
|
## If the first argument is "command", run the rest of the arguments
|
||||||
## using todo.sh builtins.
|
## using todo.sh builtins.
|
||||||
|
|||||||
Reference in New Issue
Block a user