Merge branch 'inkarkat/master'
This commit is contained in:
40
tests/t0002-actions.sh
Executable file
40
tests/t0002-actions.sh
Executable file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
test_description='todo.sh actions.d
|
||||||
|
|
||||||
|
This test just makes sure that todo.sh can locate custom actions.
|
||||||
|
'
|
||||||
|
. ./test-lib.sh
|
||||||
|
|
||||||
|
# All the below tests will output the custom action message
|
||||||
|
cat > expect << EOF
|
||||||
|
TODO: foo
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat > foo << EOF
|
||||||
|
echo "TODO: foo"
|
||||||
|
EOF
|
||||||
|
chmod +x foo
|
||||||
|
|
||||||
|
test_expect_success 'custom action (default location 1)' '
|
||||||
|
mkdir .todo.actions.d
|
||||||
|
cp foo .todo.actions.d/
|
||||||
|
todo.sh foo > output;
|
||||||
|
test_cmp expect output && rm -rf .todo.actions.d
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'custom action (default location 2)' '
|
||||||
|
mkdir -p .todo/actions
|
||||||
|
cp foo .todo/actions/
|
||||||
|
todo.sh foo > output;
|
||||||
|
test_cmp expect output && rm -rf .todo/actions
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'custom action (env variable)' '
|
||||||
|
mkdir myactions
|
||||||
|
cp foo myactions/
|
||||||
|
TODO_ACTIONS_DIR=myactions todo.sh foo > output;
|
||||||
|
test_cmp expect output && rm -rf myactions
|
||||||
|
'
|
||||||
|
|
||||||
|
test_done
|
||||||
114
tests/t1330-ls-highlighting.sh
Executable file
114
tests/t1330-ls-highlighting.sh
Executable file
@@ -0,0 +1,114 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
|
||||||
|
test_description='list highlighting
|
||||||
|
|
||||||
|
This test checks the highlighting (with colors) of prioritized tasks.
|
||||||
|
'
|
||||||
|
. ./test-lib.sh
|
||||||
|
|
||||||
|
TEST_TODO_=todo.cfg
|
||||||
|
|
||||||
|
#
|
||||||
|
# check the highlighting of prioritized tasks
|
||||||
|
#
|
||||||
|
cat > todo.txt <<EOF
|
||||||
|
(A) @con01 +prj01 -- Some project 01 task, pri A
|
||||||
|
(B) @con02 +prj02 -- Some project 02 task, pri B
|
||||||
|
(C) @con01 +prj01 -- Some project 01 task, pri C
|
||||||
|
(D) @con02 +prj02 -- Some project 02 task, pri D
|
||||||
|
(E) @con01 +prj01 -- Some project 01 task, pri E
|
||||||
|
(Z) @con02 +prj02 -- Some project 02 task, pri Z
|
||||||
|
@con01 +prj01 -- Some project 01 task, no priority
|
||||||
|
@con02 +prj02 -- Some project 02 task, no priority
|
||||||
|
EOF
|
||||||
|
test_todo_session 'default highlighting' <<EOF
|
||||||
|
>>> todo.sh ls
|
||||||
|
[1;33m1 (A) @con01 +prj01 -- Some project 01 task, pri A[0m
|
||||||
|
[0;32m2 (B) @con02 +prj02 -- Some project 02 task, pri B[0m
|
||||||
|
[1;34m3 (C) @con01 +prj01 -- Some project 01 task, pri C[0m
|
||||||
|
[1;37m4 (D) @con02 +prj02 -- Some project 02 task, pri D[0m
|
||||||
|
[1;37m5 (E) @con01 +prj01 -- Some project 01 task, pri E[0m
|
||||||
|
[1;37m6 (Z) @con02 +prj02 -- Some project 02 task, pri Z[0m
|
||||||
|
7 @con01 +prj01 -- Some project 01 task, no priority
|
||||||
|
8 @con02 +prj02 -- Some project 02 task, no priority
|
||||||
|
--
|
||||||
|
TODO: 8 of 8 tasks shown
|
||||||
|
EOF
|
||||||
|
|
||||||
|
#
|
||||||
|
# check changing the color definitions into something other than ANSI color
|
||||||
|
# escape sequences
|
||||||
|
#
|
||||||
|
TEST_TODO_CUSTOM=todo-custom.cfg
|
||||||
|
cat todo.cfg > "$TEST_TODO_CUSTOM"
|
||||||
|
cat >> "$TEST_TODO_CUSTOM" <<'EOF'
|
||||||
|
export YELLOW='${color yellow}'
|
||||||
|
export GREEN='${color green}'
|
||||||
|
export LIGHT_BLUE='${color LightBlue}'
|
||||||
|
export WHITE='${color white}'
|
||||||
|
export DEFAULT='${color}'
|
||||||
|
export PRI_A=$YELLOW
|
||||||
|
export PRI_B=$GREEN
|
||||||
|
export PRI_C=$LIGHT_BLUE
|
||||||
|
export PRI_X=$WHITE
|
||||||
|
EOF
|
||||||
|
test_todo_session 'customized highlighting' <<'EOF'
|
||||||
|
>>> todo.sh -d "$TEST_TODO_CUSTOM" ls
|
||||||
|
${color yellow}1 (A) @con01 +prj01 -- Some project 01 task, pri A${color}
|
||||||
|
${color green}2 (B) @con02 +prj02 -- Some project 02 task, pri B${color}
|
||||||
|
${color LightBlue}3 (C) @con01 +prj01 -- Some project 01 task, pri C${color}
|
||||||
|
${color white}4 (D) @con02 +prj02 -- Some project 02 task, pri D${color}
|
||||||
|
${color white}5 (E) @con01 +prj01 -- Some project 01 task, pri E${color}
|
||||||
|
${color white}6 (Z) @con02 +prj02 -- Some project 02 task, pri Z${color}
|
||||||
|
7 @con01 +prj01 -- Some project 01 task, no priority
|
||||||
|
8 @con02 +prj02 -- Some project 02 task, no priority
|
||||||
|
--
|
||||||
|
TODO: 8 of 8 tasks shown
|
||||||
|
EOF
|
||||||
|
|
||||||
|
#
|
||||||
|
# check defining highlightings for more priorities than the default A, B, C
|
||||||
|
#
|
||||||
|
TEST_TODO_ADDITIONAL=todo-additional.cfg
|
||||||
|
cat todo.cfg > "$TEST_TODO_ADDITIONAL"
|
||||||
|
cat >> "$TEST_TODO_ADDITIONAL" <<'EOF'
|
||||||
|
export PRI_E=$BROWN
|
||||||
|
export PRI_Z=$LIGHT_PURPLE
|
||||||
|
EOF
|
||||||
|
test_todo_session 'additional highlighting pri E+Z' <<'EOF'
|
||||||
|
>>> todo.sh -d "$TEST_TODO_ADDITIONAL" ls
|
||||||
|
[1;33m1 (A) @con01 +prj01 -- Some project 01 task, pri A[0m
|
||||||
|
[0;32m2 (B) @con02 +prj02 -- Some project 02 task, pri B[0m
|
||||||
|
[1;34m3 (C) @con01 +prj01 -- Some project 01 task, pri C[0m
|
||||||
|
[1;37m4 (D) @con02 +prj02 -- Some project 02 task, pri D[0m
|
||||||
|
[0;33m5 (E) @con01 +prj01 -- Some project 01 task, pri E[0m
|
||||||
|
[1;35m6 (Z) @con02 +prj02 -- Some project 02 task, pri Z[0m
|
||||||
|
7 @con01 +prj01 -- Some project 01 task, no priority
|
||||||
|
8 @con02 +prj02 -- Some project 02 task, no priority
|
||||||
|
--
|
||||||
|
TODO: 8 of 8 tasks shown
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# check changing the fallback highlighting for undefined priorities
|
||||||
|
#
|
||||||
|
TEST_TODO_PRI_X=todo-pri-x.cfg
|
||||||
|
cat todo.cfg > "$TEST_TODO_PRI_X"
|
||||||
|
cat >> "$TEST_TODO_PRI_X" <<'EOF'
|
||||||
|
export PRI_X=$BROWN
|
||||||
|
EOF
|
||||||
|
test_todo_session 'different highlighting for pri X' <<'EOF'
|
||||||
|
>>> todo.sh -d "$TEST_TODO_PRI_X" ls
|
||||||
|
[1;33m1 (A) @con01 +prj01 -- Some project 01 task, pri A[0m
|
||||||
|
[0;32m2 (B) @con02 +prj02 -- Some project 02 task, pri B[0m
|
||||||
|
[1;34m3 (C) @con01 +prj01 -- Some project 01 task, pri C[0m
|
||||||
|
[0;33m4 (D) @con02 +prj02 -- Some project 02 task, pri D[0m
|
||||||
|
[0;33m5 (E) @con01 +prj01 -- Some project 01 task, pri E[0m
|
||||||
|
[0;33m6 (Z) @con02 +prj02 -- Some project 02 task, pri Z[0m
|
||||||
|
7 @con01 +prj01 -- Some project 01 task, no priority
|
||||||
|
8 @con02 +prj02 -- Some project 02 task, no priority
|
||||||
|
--
|
||||||
|
TODO: 8 of 8 tasks shown
|
||||||
|
EOF
|
||||||
|
|
||||||
|
test_done
|
||||||
52
tests/t8000-actions.sh
Executable file
52
tests/t8000-actions.sh
Executable file
@@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
test_description='custom actions functionality
|
||||||
|
|
||||||
|
This test covers the contract between todo.sh and custom actions.
|
||||||
|
'
|
||||||
|
. ./test-lib.sh
|
||||||
|
|
||||||
|
unset TODO_ACTIONS_DIR
|
||||||
|
mkdir .todo.actions.d
|
||||||
|
cat > .todo.actions.d/foo << EOF
|
||||||
|
echo "TODO: foo"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
test_todo_session 'nonexecutable action' <<EOF
|
||||||
|
>>> todo.sh foo
|
||||||
|
Usage: todo.sh [-fhpantvV] [-d todo_config] action [task_number] [task_description]
|
||||||
|
Try 'todo.sh -h' for more information.
|
||||||
|
=== 1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chmod +x .todo.actions.d/foo
|
||||||
|
test_todo_session 'executable action' <<EOF
|
||||||
|
>>> todo.sh foo
|
||||||
|
TODO: foo
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat > .todo.actions.d/ls << EOF
|
||||||
|
echo "TODO: my ls"
|
||||||
|
EOF
|
||||||
|
chmod +x .todo.actions.d/ls
|
||||||
|
test_todo_session 'overriding built-in action' <<EOF
|
||||||
|
>>> todo.sh ls
|
||||||
|
TODO: my ls
|
||||||
|
|
||||||
|
>>> todo.sh command ls
|
||||||
|
--
|
||||||
|
TODO: 0 of 0 tasks shown
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat > .todo.actions.d/bad << EOF
|
||||||
|
echo "TODO: bad"
|
||||||
|
exit 42
|
||||||
|
EOF
|
||||||
|
chmod +x .todo.actions.d/bad
|
||||||
|
test_todo_session 'failing action' <<EOF
|
||||||
|
>>> todo.sh bad
|
||||||
|
TODO: bad
|
||||||
|
=== 42
|
||||||
|
EOF
|
||||||
|
|
||||||
|
test_done
|
||||||
@@ -542,7 +542,7 @@ test_todo_session () {
|
|||||||
if [ $status = 0 ]; then
|
if [ $status = 0 ]; then
|
||||||
test_expect_success "$1 $subnum" "$cmd > output && test_cmp expect output"
|
test_expect_success "$1 $subnum" "$cmd > output && test_cmp expect output"
|
||||||
else
|
else
|
||||||
test_expect_success "$1 $subnum" "$cmd > output || test $? = $status && test_cmp expect output"
|
test_expect_success "$1 $subnum" "$cmd > output ; test \$? = $status && test_cmp expect output"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
subnum=$(($subnum + 1))
|
subnum=$(($subnum + 1))
|
||||||
@@ -560,7 +560,7 @@ test_todo_session () {
|
|||||||
if [ $status = 0 ]; then
|
if [ $status = 0 ]; then
|
||||||
test_expect_success "$1 $subnum" "$cmd > output && test_cmp expect output"
|
test_expect_success "$1 $subnum" "$cmd > output && test_cmp expect output"
|
||||||
else
|
else
|
||||||
test_expect_success "$1 $subnum" "$cmd > output || test $? = $status && test_cmp expect output"
|
test_expect_success "$1 $subnum" "$cmd > output ; test \$? = $status && test_cmp expect output"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
74
todo.sh
74
todo.sh
@@ -250,7 +250,7 @@ die()
|
|||||||
cleanup()
|
cleanup()
|
||||||
{
|
{
|
||||||
[ -f "$TMP_FILE" ] && rm "$TMP_FILE"
|
[ -f "$TMP_FILE" ] && rm "$TMP_FILE"
|
||||||
exit 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
cleaninput()
|
cleaninput()
|
||||||
@@ -279,7 +279,6 @@ archive()
|
|||||||
sed -n 'G; s/\n/&&/; /^\([ ~-]*\n\).*\n\1/d; s/\n//; h; P' "$TMP_FILE" > "$TODO_FILE"
|
sed -n 'G; s/\n/&&/; /^\([ ~-]*\n\).*\n\1/d; s/\n//; h; P' "$TMP_FILE" > "$TODO_FILE"
|
||||||
#[[ $TODOTXT_VERBOSE -gt 0 ]] && echo "TODO: Duplicate tasks have been removed."
|
#[[ $TODOTXT_VERBOSE -gt 0 ]] && echo "TODO: Duplicate tasks have been removed."
|
||||||
[ $TODOTXT_VERBOSE -gt 0 ] && echo "TODO: $TODO_FILE archived."
|
[ $TODOTXT_VERBOSE -gt 0 ] && echo "TODO: $TODO_FILE archived."
|
||||||
cleanup
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -460,9 +459,9 @@ ACTION=${1:-$TODOTXT_DEFAULT_ACTION}
|
|||||||
[ -f "$REPORT_FILE" ] || cp /dev/null "$REPORT_FILE"
|
[ -f "$REPORT_FILE" ] || cp /dev/null "$REPORT_FILE"
|
||||||
|
|
||||||
if [ $TODOTXT_PLAIN = 1 ]; then
|
if [ $TODOTXT_PLAIN = 1 ]; then
|
||||||
PRI_A=$NONE
|
for clr in ${!PRI_@}; do
|
||||||
PRI_B=$NONE
|
export $clr=$NONE
|
||||||
PRI_C=$NONE
|
done
|
||||||
PRI_X=$NONE
|
PRI_X=$NONE
|
||||||
DEFAULT=$NONE
|
DEFAULT=$NONE
|
||||||
fi
|
fi
|
||||||
@@ -570,14 +569,14 @@ _list() {
|
|||||||
s/^ /0/;
|
s/^ /0/;
|
||||||
''' \
|
''' \
|
||||||
| eval ${TODOTXT_SORT_COMMAND} \
|
| eval ${TODOTXT_SORT_COMMAND} \
|
||||||
| sed '''
|
| awk '''{
|
||||||
/^[0-9]\{'$PADDING'\} x /! {
|
pos = match($0, /\([A-Z]\)/)
|
||||||
/(A)/ s|^.*|'$PRI_A'&'$DEFAULT'|
|
if( pos > 0 && match($0, /^[0-9]+ x /) != 1 ) {
|
||||||
/(B)/ s|^.*|'$PRI_B'&'$DEFAULT'|
|
clr=ENVIRON["PRI_" substr($0, pos+1, 1)]
|
||||||
/(C)/ s|^.*|'$PRI_C'&'$DEFAULT'|
|
str = ( clr ? clr : ENVIRON["PRI_X"] ) $0 ENVIRON["DEFAULT"]
|
||||||
/([D-Z])/ s|^.*|'$PRI_X'&'$DEFAULT'|
|
gsub( /\\+033/, "\033", str) ; print str
|
||||||
}
|
} else { print }
|
||||||
''' \
|
}''' \
|
||||||
| sed '''
|
| sed '''
|
||||||
s/'${HIDE_PRIORITY_SUBSTITUTION:-^}'//g
|
s/'${HIDE_PRIORITY_SUBSTITUTION:-^}'//g
|
||||||
s/'${HIDE_PROJECTS_SUBSTITUTION:-^}'//g
|
s/'${HIDE_PROJECTS_SUBSTITUTION:-^}'//g
|
||||||
@@ -602,7 +601,7 @@ _list() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
export -f _list
|
export -f _list die
|
||||||
|
|
||||||
# == HANDLE ACTION ==
|
# == HANDLE ACTION ==
|
||||||
action=$( printf "%s\n" "$ACTION" | tr 'A-Z' 'a-z' )
|
action=$( printf "%s\n" "$ACTION" | tr 'A-Z' 'a-z' )
|
||||||
@@ -620,7 +619,9 @@ then
|
|||||||
elif [ -d "$TODO_ACTIONS_DIR" -a -x "$TODO_ACTIONS_DIR/$action" ]
|
elif [ -d "$TODO_ACTIONS_DIR" -a -x "$TODO_ACTIONS_DIR/$action" ]
|
||||||
then
|
then
|
||||||
"$TODO_ACTIONS_DIR/$action" "$@"
|
"$TODO_ACTIONS_DIR/$action" "$@"
|
||||||
|
status=$?
|
||||||
cleanup
|
cleanup
|
||||||
|
exit $status
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Only run if $action isn't found in .todo.actions.d
|
## Only run if $action isn't found in .todo.actions.d
|
||||||
@@ -635,7 +636,7 @@ case $action in
|
|||||||
input=$*
|
input=$*
|
||||||
fi
|
fi
|
||||||
_addto "$TODO_FILE" "$input"
|
_addto "$TODO_FILE" "$input"
|
||||||
cleanup;;
|
;;
|
||||||
|
|
||||||
"addm")
|
"addm")
|
||||||
if [[ -z "$2" && $TODOTXT_FORCE = 0 ]]; then
|
if [[ -z "$2" && $TODOTXT_FORCE = 0 ]]; then
|
||||||
@@ -657,7 +658,7 @@ case $action in
|
|||||||
_addto "$TODO_FILE" "$line"
|
_addto "$TODO_FILE" "$line"
|
||||||
done
|
done
|
||||||
IFS=$SAVEIFS
|
IFS=$SAVEIFS
|
||||||
cleanup;;
|
;;
|
||||||
|
|
||||||
"addto" )
|
"addto" )
|
||||||
[ -z "$2" ] && die "usage: $TODO_SH addto DEST \"TODO ITEM\""
|
[ -z "$2" ] && die "usage: $TODO_SH addto DEST \"TODO ITEM\""
|
||||||
@@ -672,7 +673,7 @@ case $action in
|
|||||||
else
|
else
|
||||||
echo "TODO: Destination file $dest does not exist."
|
echo "TODO: Destination file $dest does not exist."
|
||||||
fi
|
fi
|
||||||
cleanup;;
|
;;
|
||||||
|
|
||||||
"append" | "app" )
|
"append" | "app" )
|
||||||
errmsg="usage: $TODO_SH append ITEM# \"TEXT TO APPEND\""
|
errmsg="usage: $TODO_SH append ITEM# \"TEXT TO APPEND\""
|
||||||
@@ -698,7 +699,7 @@ case $action in
|
|||||||
else
|
else
|
||||||
echo "TODO: Error appending task $item."
|
echo "TODO: Error appending task $item."
|
||||||
fi
|
fi
|
||||||
cleanup;;
|
;;
|
||||||
|
|
||||||
"archive" )
|
"archive" )
|
||||||
archive;;
|
archive;;
|
||||||
@@ -730,7 +731,6 @@ case $action in
|
|||||||
sed -i.bak -e $item"s/^.*//" "$TODO_FILE"
|
sed -i.bak -e $item"s/^.*//" "$TODO_FILE"
|
||||||
fi
|
fi
|
||||||
[ $TODOTXT_VERBOSE -gt 0 ] && echo "TODO: '$DELETEME' deleted."
|
[ $TODOTXT_VERBOSE -gt 0 ] && echo "TODO: '$DELETEME' deleted."
|
||||||
cleanup
|
|
||||||
else
|
else
|
||||||
echo "TODO: No tasks were deleted."
|
echo "TODO: No tasks were deleted."
|
||||||
fi
|
fi
|
||||||
@@ -740,7 +740,8 @@ case $action in
|
|||||||
else
|
else
|
||||||
sed -i.bak -e $item"s/$3/ /g" "$TODO_FILE"
|
sed -i.bak -e $item"s/$3/ /g" "$TODO_FILE"
|
||||||
[ $TODOTXT_VERBOSE -gt 0 ] && echo "TODO: $3 removed from $item."
|
[ $TODOTXT_VERBOSE -gt 0 ] && echo "TODO: $3 removed from $item."
|
||||||
fi ;;
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
"depri" | "dp" )
|
"depri" | "dp" )
|
||||||
errmsg="usage: $TODO_SH depri ITEM#[, ITEM#, ITEM#, ...]"
|
errmsg="usage: $TODO_SH depri ITEM#[, ITEM#, ITEM#, ...]"
|
||||||
@@ -768,7 +769,7 @@ case $action in
|
|||||||
die "$errmsg"
|
die "$errmsg"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
cleanup ;;
|
;;
|
||||||
|
|
||||||
"do" )
|
"do" )
|
||||||
errmsg="usage: $TODO_SH do ITEM#[, ITEM#, ITEM#, ...]"
|
errmsg="usage: $TODO_SH do ITEM#[, ITEM#, ITEM#, ...]"
|
||||||
@@ -804,7 +805,7 @@ case $action in
|
|||||||
if [ $TODOTXT_AUTO_ARCHIVE = 1 ]; then
|
if [ $TODOTXT_AUTO_ARCHIVE = 1 ]; then
|
||||||
archive
|
archive
|
||||||
fi
|
fi
|
||||||
cleanup ;;
|
;;
|
||||||
|
|
||||||
"help" )
|
"help" )
|
||||||
if [ -t 1 ] ; then # STDOUT is a TTY
|
if [ -t 1 ] ; then # STDOUT is a TTY
|
||||||
@@ -819,8 +820,6 @@ case $action in
|
|||||||
"list" | "ls" )
|
"list" | "ls" )
|
||||||
shift ## Was ls; new $1 is first search term
|
shift ## Was ls; new $1 is first search term
|
||||||
_list "$TODO_FILE" "$@"
|
_list "$TODO_FILE" "$@"
|
||||||
|
|
||||||
cleanup
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"listall" | "lsa" )
|
"listall" | "lsa" )
|
||||||
@@ -828,8 +827,6 @@ case $action in
|
|||||||
|
|
||||||
cat "$TODO_FILE" "$DONE_FILE" > "$TMP_FILE"
|
cat "$TODO_FILE" "$DONE_FILE" > "$TMP_FILE"
|
||||||
_list "$TMP_FILE" "$@"
|
_list "$TMP_FILE" "$@"
|
||||||
|
|
||||||
cleanup
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"listfile" | "lf" )
|
"listfile" | "lf" )
|
||||||
@@ -838,18 +835,15 @@ case $action in
|
|||||||
shift ## Was filename; next $1 is first search term
|
shift ## Was filename; next $1 is first search term
|
||||||
|
|
||||||
_list "$FILE" "$@"
|
_list "$FILE" "$@"
|
||||||
|
|
||||||
cleanup
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"listcon" | "lsc" )
|
"listcon" | "lsc" )
|
||||||
grep -o '[^ ]*@[^ ]\+' "$TODO_FILE" | grep '^@' | sort -u
|
grep -o '[^ ]*@[^ ]\+' "$TODO_FILE" | grep '^@' | sort -u
|
||||||
cleanup ;;
|
;;
|
||||||
|
|
||||||
"listproj" | "lsprj" )
|
"listproj" | "lsprj" )
|
||||||
grep -o '[^ ]*+[^ ]\+' "$TODO_FILE" | grep '^+' | sort -u
|
grep -o '[^ ]*+[^ ]\+' "$TODO_FILE" | grep '^+' | sort -u
|
||||||
cleanup ;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
"listpri" | "lsp" )
|
"listpri" | "lsp" )
|
||||||
shift ## was "listpri", new $1 is priority to list
|
shift ## was "listpri", new $1 is priority to list
|
||||||
@@ -904,7 +898,6 @@ case $action in
|
|||||||
echo "$MOVEME" >> "$dest"
|
echo "$MOVEME" >> "$dest"
|
||||||
|
|
||||||
[ $TODOTXT_VERBOSE -gt 0 ] && echo "TODO: '$MOVEME' moved from '$src' to '$dest'."
|
[ $TODOTXT_VERBOSE -gt 0 ] && echo "TODO: '$MOVEME' moved from '$src' to '$dest'."
|
||||||
cleanup
|
|
||||||
else
|
else
|
||||||
echo "TODO: No tasks moved."
|
echo "TODO: No tasks moved."
|
||||||
fi
|
fi
|
||||||
@@ -917,7 +910,7 @@ case $action in
|
|||||||
else
|
else
|
||||||
echo "TODO: Source file $src does not exist."
|
echo "TODO: Source file $src does not exist."
|
||||||
fi
|
fi
|
||||||
cleanup;;
|
;;
|
||||||
|
|
||||||
"prepend" | "prep" )
|
"prepend" | "prep" )
|
||||||
errmsg="usage: $TODO_SH prepend ITEM# \"TEXT TO PREPEND\""
|
errmsg="usage: $TODO_SH prepend ITEM# \"TEXT TO PREPEND\""
|
||||||
@@ -963,7 +956,7 @@ case $action in
|
|||||||
echo "TODO: Error prepending task $item."
|
echo "TODO: Error prepending task $item."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
cleanup;;
|
;;
|
||||||
|
|
||||||
"pri" | "p" )
|
"pri" | "p" )
|
||||||
item=$2
|
item=$2
|
||||||
@@ -986,10 +979,10 @@ note: PRIORITY must be anywhere from A to Z."
|
|||||||
echo "$item: $NEWTODO"
|
echo "$item: $NEWTODO"
|
||||||
echo "TODO: $item prioritized ($newpri)."
|
echo "TODO: $item prioritized ($newpri)."
|
||||||
}
|
}
|
||||||
cleanup
|
|
||||||
else
|
else
|
||||||
die "$errmsg"
|
die "$errmsg"
|
||||||
fi;;
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
"replace" )
|
"replace" )
|
||||||
errmsg="usage: $TODO_SH replace ITEM# \"UPDATED ITEM\""
|
errmsg="usage: $TODO_SH replace ITEM# \"UPDATED ITEM\""
|
||||||
@@ -1026,7 +1019,7 @@ note: PRIORITY must be anywhere from A to Z."
|
|||||||
echo "replaced with"
|
echo "replaced with"
|
||||||
echo "$item: $NEWTODO"
|
echo "$item: $NEWTODO"
|
||||||
}
|
}
|
||||||
cleanup;;
|
;;
|
||||||
|
|
||||||
"report" )
|
"report" )
|
||||||
#archive first
|
#archive first
|
||||||
@@ -1045,9 +1038,10 @@ note: PRIORITY must be anywhere from A to Z."
|
|||||||
echo $TECHO >> "$REPORT_FILE"
|
echo $TECHO >> "$REPORT_FILE"
|
||||||
[ $TODOTXT_VERBOSE -gt 0 ] && echo "TODO: Report file updated."
|
[ $TODOTXT_VERBOSE -gt 0 ] && echo "TODO: Report file updated."
|
||||||
cat "$REPORT_FILE"
|
cat "$REPORT_FILE"
|
||||||
cleanup;;
|
;;
|
||||||
|
|
||||||
* )
|
* )
|
||||||
usage
|
usage;;
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
cleanup
|
||||||
|
|||||||
Reference in New Issue
Block a user