- Fixed: Reduce shellcheck warnings.
- Fixed: Remove trailing whitespace.
- Fixed: Double quote to prevent globbing and word splitting. [SC2086]
- Fixed: Invalid flags are not handled. [SC2220]
- Fixed: Cleaned up string replaces.
This commit is contained in:
tpikonen
2018-04-05 03:33:09 +03:00
committed by Ali Karbassi
parent 867ade5701
commit 7a30199fe0

178
todo.sh
View File

@@ -134,7 +134,7 @@ help()
EndOptionsHelp
[ $TODOTXT_VERBOSE -gt 1 ] && cat <<-'EndVerboseHelp'
[ "$TODOTXT_VERBOSE" -gt 1 ] && cat <<-'EndVerboseHelp'
Environment variables:
TODOTXT_AUTO_ARCHIVE is same as option -a (0)/-A (1)
TODOTXT_CFG_FILE=CONFIG_FILE is same as option -d CONFIG_FILE
@@ -293,7 +293,7 @@ addonHelp()
didPrintAddonActionsHeader=
for action in "$TODO_ACTIONS_DIR"/*
do
if [ -f "$action" -a -x "$action" ]; then
if [ -f "$action" ] && [ -x "$action" ]; then
if [ ! "$didPrintAddonActionsHeader" ]; then
cat <<-EndAddonActionsHeader
Add-on Actions:
@@ -301,14 +301,14 @@ addonHelp()
didPrintAddonActionsHeader=1
fi
"$action" usage
elif [ -d "$action" -a -x "$action/$(basename $action)" ]; then
elif [ -d "$action" ] && [ -x "$action"/"$(basename "$action")" ]; then
if [ ! "$didPrintAddonActionsHeader" ]; then
cat <<-EndAddonActionsHeader
Add-on Actions:
EndAddonActionsHeader
didPrintAddonActionsHeader=1
fi
"$action/$(basename $action)" usage
"$action"/"$(basename "$action")" usage
fi
done
fi
@@ -319,10 +319,10 @@ actionUsage()
for actionName
do
action="${TODO_ACTIONS_DIR}/${actionName}"
if [ -f "$action" -a -x "$action" ]; then
if [ -f "$action" ] && [ -x "$action" ]; then
"$action" usage
elif [ -d "$action" -a -x "$action/$(basename $action)" ]; then
"$action/$(basename $action)" usage
elif [ -d "$action" ] && [ -x "$action"/"$(basename "$action")" ]; then
"$action"/"$(basename "$action")" usage
else
builtinActionUsage=$(actionsHelp | sed -n -e "/^ ${actionName//\//\\/} /,/^\$/p" -e "/^ ${actionName//\//\\/}$/,/^\$/p")
if [ "$builtinActionUsage" ]; then
@@ -377,8 +377,9 @@ getPrefix()
# Parameters: $1: todo file; empty means $TODO_FILE.
# Returns: Uppercase FILE prefix to be used in place of "TODO:" where
# a different todo file can be specified.
local base=$(basename "${1:-$TODO_FILE}")
echo "${base%%.[^.]*}" | tr 'a-z' 'A-Z'
local base
base=$(basename "${1:-$TODO_FILE}")
echo "${base%%.[^.]*}" | tr '[:lower:]' '[:upper:]'
}
getTodo()
@@ -403,8 +404,8 @@ getNewtodo()
# Postcondition: $newtodo contains task text.
local item=$1
[ -z "$item" ] && die 'Programming error: $item should exist.'
[ "${item//[0-9]/}" ] && die 'Programming error: $item should be numeric.'
[ -z "$item" ] && die "Programming error: $item should exist."
[ "${item//[0-9]/}" ] && die "Programming error: $item should be numeric."
newtodo=$(sed "$item!d" "${2:-$TODO_FILE}")
[ -z "$newtodo" ] && die "$(getPrefix "$2"): No updated task $item."
@@ -428,7 +429,7 @@ replaceOrPrepend()
if [[ -z "$1" && $TODOTXT_FORCE = 0 ]]; then
echo -n "$querytext"
read -r -i $todo -e input
read -r -i "$todo" -e input
else
input=$*
fi
@@ -438,7 +439,7 @@ replaceOrPrepend()
priority=$(sed -e "$item!d" -e "${item}s/${priAndDateExpr}.*/\\1/" "$TODO_FILE")
prepdate=$(sed -e "$item!d" -e "${item}s/${priAndDateExpr}.*/\\2/" "$TODO_FILE")
if [ "$prepdate" -a "$action" = "replace" ] && [ "$(echo "$input"|sed -e "s/${priAndDateExpr}.*/\\1\\2/")" ]; then
if [ "$prepdate" ] && [ "$action" = "replace" ] && [ "$(echo "$input"|sed -e "s/${priAndDateExpr}.*/\\1\\2/")" ]; then
# If the replaced text starts with a [priority +] date, it will replace
# the existing date, too.
prepdate=
@@ -449,7 +450,7 @@ replaceOrPrepend()
# date again.
cleaninput "for sed"
sed -i.bak -e "$item s/^${priority}${prepdate}//" -e "$item s|^.*|${priority}${prepdate}${input}${backref}|" "$TODO_FILE"
if [ $TODOTXT_VERBOSE -gt 0 ]; then
if [ "$TODOTXT_VERBOSE" -gt 0 ]; then
getNewtodo "$item"
case "$action" in
replace)
@@ -474,7 +475,7 @@ uppercasePriority()
do
upperPriority="${upperPriority};s/^[(]${lower[i]}[)]/(${upper[i]})/"
done
input=$(echo "$input" | sed $upperPriority)
input=$(echo "$input" | sed "$upperPriority")
}
#Preserving environment variables so they don't get clobbered by the config file
@@ -491,20 +492,20 @@ OVR_TODOTXT_SORT_COMMAND="$TODOTXT_SORT_COMMAND"
OVR_TODOTXT_FINAL_FILTER="$TODOTXT_FINAL_FILTER"
# Prevent GREP_OPTIONS from malforming grep's output
GREP_OPTIONS=""
export GREP_OPTIONS=""
# == PROCESS OPTIONS ==
while getopts ":fhpcnNaAtTvVx+@Pd:" Option
do
case $Option in
'@' )
'@')
## HIDE_CONTEXT_NAMES starts at zero (false); increment it to one
## (true) the first time this flag is seen. Each time the flag
## is seen after that, increment it again so that an even
## number shows context names and an odd number hides context
## names.
: $(( HIDE_CONTEXT_NAMES++ ))
if [ $(( $HIDE_CONTEXT_NAMES % 2 )) -eq 0 ]
if [ $(( HIDE_CONTEXT_NAMES % 2 )) -eq 0 ]
then
## Zero or even value -- show context names
unset HIDE_CONTEXTS_SUBSTITUTION
@@ -513,14 +514,14 @@ do
export HIDE_CONTEXTS_SUBSTITUTION='[[:space:]]@[[:graph:]]\{1,\}'
fi
;;
'+' )
'+')
## HIDE_PROJECT_NAMES starts at zero (false); increment it to one
## (true) the first time this flag is seen. Each time the flag
## is seen after that, increment it again so that an even
## number shows project names and an odd number hides project
## names.
: $(( HIDE_PROJECT_NAMES++ ))
if [ $(( $HIDE_PROJECT_NAMES % 2 )) -eq 0 ]
if [ $(( HIDE_PROJECT_NAMES % 2 )) -eq 0 ]
then
## Zero or even value -- show project names
unset HIDE_PROJECTS_SUBSTITUTION
@@ -529,45 +530,45 @@ do
export HIDE_PROJECTS_SUBSTITUTION='[[:space:]][+][[:graph:]]\{1,\}'
fi
;;
a )
a)
OVR_TODOTXT_AUTO_ARCHIVE=0
;;
A )
A)
OVR_TODOTXT_AUTO_ARCHIVE=1
;;
c )
c)
OVR_TODOTXT_PLAIN=0
;;
d )
d)
TODOTXT_CFG_FILE=$OPTARG
;;
f )
f)
OVR_TODOTXT_FORCE=1
;;
h )
h)
# Short-circuit option parsing and forward to the action.
# Cannot just invoke shorthelp() because we need the configuration
# processed to locate the add-on actions directory.
set -- '-h' 'shorthelp'
OPTIND=2
;;
n )
n)
OVR_TODOTXT_PRESERVE_LINE_NUMBERS=0
;;
N )
N)
OVR_TODOTXT_PRESERVE_LINE_NUMBERS=1
;;
p )
p)
OVR_TODOTXT_PLAIN=1
;;
P )
P)
## HIDE_PRIORITY_LABELS starts at zero (false); increment it to one
## (true) the first time this flag is seen. Each time the flag
## is seen after that, increment it again so that an even
## number shows priority labels and an odd number hides priority
## labels.
: $(( HIDE_PRIORITY_LABELS++ ))
if [ $(( $HIDE_PRIORITY_LABELS % 2 )) -eq 0 ]
if [ $(( HIDE_PRIORITY_LABELS % 2 )) -eq 0 ]
then
## Zero or even value -- show priority labels
unset HIDE_PRIORITY_SUBSTITUTION
@@ -576,24 +577,27 @@ do
export HIDE_PRIORITY_SUBSTITUTION="([A-Z])[[:space:]]"
fi
;;
t )
t)
OVR_TODOTXT_DATE_ON_ADD=1
;;
T )
T)
OVR_TODOTXT_DATE_ON_ADD=0
;;
v )
v)
: $(( TODOTXT_VERBOSE++ ))
;;
V )
V)
version
;;
x )
x)
OVR_TODOTXT_DISABLE_FILTER=1
;;
*)
usage
;;
esac
done
shift $(($OPTIND - 1))
shift $((OPTIND - 1))
# defaults if not yet defined
TODOTXT_VERBOSE=${TODOTXT_VERBOSE:-1}
@@ -611,7 +615,7 @@ TODOTXT_FINAL_FILTER=${TODOTXT_FINAL_FILTER:-cat}
TODOTXT_GLOBAL_CFG_FILE=${TODOTXT_GLOBAL_CFG_FILE:-/etc/todo/config}
# Export all TODOTXT_* variables
export ${!TODOTXT_@}
export "${!TODOTXT_@}"
# Default color map
export NONE=''
@@ -698,7 +702,7 @@ export SENTENCE_DELIMITERS=',.:;'
}
if [ -z "$TODO_ACTIONS_DIR" -o ! -d "$TODO_ACTIONS_DIR" ]
if [ -z "$TODO_ACTIONS_DIR" ] || [ ! -d "$TODO_ACTIONS_DIR" ]
then
TODO_ACTIONS_DIR="$HOME/.todo/actions"
export TODO_ACTIONS_DIR
@@ -765,19 +769,19 @@ fi
ACTION=${1:-$TODOTXT_DEFAULT_ACTION}
[ -z "$ACTION" ] && usage
[ -d "$TODO_DIR" ] || mkdir -p $TODO_DIR 2> /dev/null || dieWithHelp "$1" "Fatal Error: $TODO_DIR is not a directory"
[ -d "$TODO_DIR" ] || mkdir -p "$TODO_DIR" 2> /dev/null || dieWithHelp "$1" "Fatal Error: $TODO_DIR is not a directory"
( cd "$TODO_DIR" ) || dieWithHelp "$1" "Fatal Error: Unable to cd to $TODO_DIR"
[ -z "$TODOTXT_PRIORITY_ON_ADD" ] \
|| echo "$TODOTXT_PRIORITY_ON_ADD" | grep -q "^[A-Z]$" \
|| die "TODOTXT_PRIORITY_ON_ADD should be a capital letter from A to Z (it is now \"$TODOTXT_PRIORITY_ON_ADD\")."
[ -f "$TODO_FILE" -o -c "$TODO_FILE" ] || > "$TODO_FILE"
[ -f "$DONE_FILE" -o -c "$DONE_FILE" ] || > "$DONE_FILE"
[ -f "$REPORT_FILE" -o -c "$REPORT_FILE" ] || > "$REPORT_FILE"
[ -f "$TODO_FILE" ] || [ -c "$TODO_FILE" ] || > "$TODO_FILE"
[ -f "$DONE_FILE" ] || [ -c "$DONE_FILE" ] || > "$DONE_FILE"
[ -f "$REPORT_FILE" ] || [ -c "$REPORT_FILE" ] || > "$REPORT_FILE"
if [ $TODOTXT_PLAIN = 1 ]; then
for clr in ${!PRI_@}; do
export $clr=$NONE
export "$clr"=$NONE
done
PRI_X=$NONE
DEFAULT=$NONE
@@ -795,7 +799,7 @@ _addto() {
cleaninput
uppercasePriority
if [[ $TODOTXT_DATE_ON_ADD = 1 ]]; then
if [[ "$TODOTXT_DATE_ON_ADD" -eq 1 ]]; then
now=$(date '+%Y-%m-%d')
input=$(echo "$input" | sed -e 's/^\(([A-Z]) \)\{0,1\}/\1'"$now /")
fi
@@ -805,7 +809,7 @@ _addto() {
fi
fi
echo "$input" >> "$file"
if [ $TODOTXT_VERBOSE -gt 0 ]; then
if [ "$TODOTXT_VERBOSE" -gt 0 ]; then
TASKNUM=$(sed -n '$ =' "$file")
echo "$TASKNUM $input"
echo "$(getPrefix "$file"): $TASKNUM added."
@@ -873,7 +877,7 @@ _list() {
_format "$src" '' "$@"
if [ $TODOTXT_VERBOSE -gt 0 ]; then
if [ "$TODOTXT_VERBOSE" -gt 0 ]; then
echo "--"
echo "$(getPrefix "$src"): ${NUMTASKS:-0} of ${TOTALTASKS:-0} tasks shown"
fi
@@ -933,7 +937,7 @@ _format()
s/^ /00/;
s/^ /0/;
''' \
| eval ${TODOTXT_SORT_COMMAND} \
| eval "${TODOTXT_SORT_COMMAND}" \
| awk '''
function highlight(colorVar, color) {
color = ENVIRON[colorVar]
@@ -984,11 +988,11 @@ _format()
)
[ "$filtered_items" ] && echo "$filtered_items"
if [ $TODOTXT_VERBOSE -gt 0 ]; then
if [ "$TODOTXT_VERBOSE" -gt 0 ]; then
NUMTASKS=$( echo -n "$filtered_items" | sed -n '$ =' )
TOTALTASKS=$( echo -n "$items" | sed -n '$ =' )
fi
if [ $TODOTXT_VERBOSE -gt 1 ]; then
if [ "$TODOTXT_VERBOSE" -gt 1 ]; then
echo "TODO DEBUG: Filter Command was: ${filter_command:-cat}"
fi
}
@@ -1006,7 +1010,7 @@ listWordsWithSigil()
export -f cleaninput getPrefix getTodo getNewtodo shellquote filtercommand _list listWordsWithSigil getPadding _format die
# == HANDLE ACTION ==
action=$( printf "%s\n" "$ACTION" | tr 'A-Z' 'a-z' )
action=$( printf "%s\n" "$ACTION" | tr '[:upper:]' '[:lower:]' )
## If the first argument is "command", run the rest of the arguments
## using todo.sh builtins.
@@ -1017,12 +1021,12 @@ then
## Get rid of "command" from arguments list
shift
## Reset action to new first argument
action=$( printf "%s\n" "$1" | tr 'A-Z' 'a-z' )
elif [ -d "$TODO_ACTIONS_DIR/$action" -a -x "$TODO_ACTIONS_DIR/$action/$action" ]
action=$( printf "%s\n" "$1" | tr '[:upper:]' '[:lower:]' )
elif [ -d "$TODO_ACTIONS_DIR/$action" ] && [ -x "$TODO_ACTIONS_DIR/$action/$action" ]
then
"$TODO_ACTIONS_DIR/$action/$action" "$@"
exit $?
elif [ -d "$TODO_ACTIONS_DIR" -a -x "$TODO_ACTIONS_DIR/$action" ]
elif [ -d "$TODO_ACTIONS_DIR" ] && [ -x "$TODO_ACTIONS_DIR/$action" ]
then
"$TODO_ACTIONS_DIR/$action" "$@"
exit $?
@@ -1096,8 +1100,8 @@ case $action in
esac
cleaninput "for sed"
if sed -i.bak $item" s|^.*|&${appendspace}${input}|" "$TODO_FILE"; then
if [ $TODOTXT_VERBOSE -gt 0 ]; then
if sed -i.bak "${item} s|^.*|&${appendspace}${input}|" "$TODO_FILE"; then
if [ "$TODOTXT_VERBOSE" -gt 0 ]; then
getNewtodo "$item"
echo "$item $newtodo"
fi
@@ -1109,10 +1113,10 @@ case $action in
"archive" )
# defragment blank lines
sed -i.bak -e '/./!d' "$TODO_FILE"
[ $TODOTXT_VERBOSE -gt 0 ] && grep "^x " "$TODO_FILE"
[ "$TODOTXT_VERBOSE" -gt 0 ] && grep "^x " "$TODO_FILE"
grep "^x " "$TODO_FILE" >> "$DONE_FILE"
sed -i.bak '/^x /d' "$TODO_FILE"
if [ $TODOTXT_VERBOSE -gt 0 ]; then
if [ "$TODOTXT_VERBOSE" -gt 0 ]; then
echo "TODO: $TODO_FILE archived."
fi
;;
@@ -1133,12 +1137,12 @@ case $action in
if [ "$ANSWER" = "y" ]; then
if [ $TODOTXT_PRESERVE_LINE_NUMBERS = 0 ]; then
# delete line (changes line numbers)
sed -i.bak -e $item"s/^.*//" -e '/./!d' "$TODO_FILE"
sed -i.bak -e "${item}s/^.*//" -e '/./!d' "$TODO_FILE"
else
# leave blank line behind (preserves line numbers)
sed -i.bak -e $item"s/^.*//" "$TODO_FILE"
sed -i.bak -e "${item}s/^.*//" "$TODO_FILE"
fi
if [ $TODOTXT_VERBOSE -gt 0 ]; then
if [ "$TODOTXT_VERBOSE" -gt 0 ]; then
echo "$item $todo"
echo "TODO: $item deleted."
fi
@@ -1147,18 +1151,18 @@ case $action in
fi
else
sed -i.bak \
-e $item"s/^\((.) \)\{0,1\} *$3 */\1/g" \
-e $item"s/ *$3 *\$//g" \
-e $item"s/ *$3 */ /g" \
-e $item"s/ *$3 */ /g" \
-e $item"s/$3//g" \
-e "${item}s/^\((.) \)\{0,1\} *$3 */\1/g" \
-e "${item}s/ *$3 *\$//g" \
-e "${item}s/ *$3 */ /g" \
-e "${item}s/ *$3 */ /g" \
-e "${item}s/$3//g" \
"$TODO_FILE"
getNewtodo "$item"
if [ "$todo" = "$newtodo" ]; then
[ $TODOTXT_VERBOSE -gt 0 ] && echo "$item $todo"
[ "$TODOTXT_VERBOSE" -gt 0 ] && echo "$item $todo"
die "TODO: '$3' not found; no removal done."
fi
if [ $TODOTXT_VERBOSE -gt 0 ]; then
if [ "$TODOTXT_VERBOSE" -gt 0 ]; then
echo "$item $todo"
echo "TODO: Removed '$3' from task."
echo "$item $newtodo"
@@ -1177,8 +1181,8 @@ case $action in
getTodo "$item"
if [[ "$todo" = \(?\)\ * ]]; then
sed -i.bak -e $item"s/^(.) //" "$TODO_FILE"
if [ $TODOTXT_VERBOSE -gt 0 ]; then
sed -i.bak -e "${item}s/^(.) //" "$TODO_FILE"
if [ "$TODOTXT_VERBOSE" -gt 0 ]; then
getNewtodo "$item"
echo "$item $newtodo"
echo "TODO: $item deprioritized."
@@ -1204,9 +1208,9 @@ case $action in
if [ "${todo:0:2}" != "x " ]; then
now=$(date '+%Y-%m-%d')
# remove priority once item is done
sed -i.bak $item"s/^(.) //" "$TODO_FILE"
sed -i.bak $item"s|^|x $now |" "$TODO_FILE"
if [ $TODOTXT_VERBOSE -gt 0 ]; then
sed -i.bak "${item}s/^(.) //" "$TODO_FILE"
sed -i.bak "${item}s|^|x $now |" "$TODO_FILE"
if [ "$TODOTXT_VERBOSE" -gt 0 ]; then
getNewtodo "$item"
echo "$item $newtodo"
echo "TODO: $item marked as done."
@@ -1263,7 +1267,7 @@ case $action in
post_filter_command="${post_filter_command:-}${post_filter_command:+ | }awk -v TOTAL=$TOTAL -v PADDING=$PADDING '{ \$1 = sprintf(\"%\" PADDING \"d\", (\$1 > TOTAL ? 0 : \$1)); print }' "
cat "$TODO_FILE" "$DONE_FILE" | TODOTXT_VERBOSE=0 _format '' "$PADDING" "$@"
if [ $TODOTXT_VERBOSE -gt 0 ]; then
if [ "$TODOTXT_VERBOSE" -gt 0 ]; then
TDONE=$( sed -n '$ =' "$DONE_FILE" )
TASKNUM=$(TODOTXT_PLAIN=1 TODOTXT_VERBOSE=0 _format "$TODO_FILE" 1 "$@" | sed -n '$ =')
DONENUM=$(TODOTXT_PLAIN=1 TODOTXT_VERBOSE=0 _format "$DONE_FILE" 1 "$@" | sed -n '$ =')
@@ -1277,8 +1281,8 @@ case $action in
"listfile" | "lf" )
shift ## Was listfile, next $1 is file name
if [ $# -eq 0 ]; then
[ $TODOTXT_VERBOSE -gt 0 ] && echo "Files in the todo.txt directory:"
cd "$TODO_DIR" && ls -1 *.txt
[ "$TODOTXT_VERBOSE" -gt 0 ] && echo "Files in the todo.txt directory:"
cd "$TODO_DIR" && ls -1 -- *.txt
else
FILE="$1"
shift ## Was filename; next $1 is first search term
@@ -1300,7 +1304,7 @@ case $action in
"listpri" | "lsp" )
shift ## was "listpri", new $1 is priority to list or first TERM
pri=$(printf "%s\n" "$1" | tr 'a-z' 'A-Z' | grep -e '^[A-Z]$' -e '^[A-Z]-[A-Z]$') && shift || pri="A-Z"
pri=$(printf "%s\n" "$1" | tr '[:lower:]' '[:upper:]' | grep -e '^[A-Z]$' -e '^[A-Z]-[A-Z]$') && shift || pri="A-Z"
post_filter_command="${post_filter_command:-}${post_filter_command:+ | }grep '^ *[0-9]\+ ([${pri}]) '"
_list "$TODO_FILE" "$@"
;;
@@ -1329,14 +1333,14 @@ case $action in
if [ "$ANSWER" = "y" ]; then
if [ $TODOTXT_PRESERVE_LINE_NUMBERS = 0 ]; then
# delete line (changes line numbers)
sed -i.bak -e $item"s/^.*//" -e '/./!d' "$src"
sed -i.bak -e "${item}s/^.*//" -e '/./!d' "$src"
else
# leave blank line behind (preserves line numbers)
sed -i.bak -e $item"s/^.*//" "$src"
sed -i.bak -e "${item}s/^.*//" "$src"
fi
echo "$todo" >> "$dest"
if [ $TODOTXT_VERBOSE -gt 0 ]; then
if [ "$TODOTXT_VERBOSE" -gt 0 ]; then
echo "$item $todo"
echo "TODO: $item moved from '$src' to '$dest'."
fi
@@ -1352,7 +1356,7 @@ case $action in
"pri" | "p" )
item=$2
newpri=$( printf "%s\n" "$3" | tr 'a-z' 'A-Z' )
newpri=$( printf "%s\n" "$3" | tr '[:lower:]' '[:upper:]' )
errmsg="usage: $TODO_SH pri ITEM# PRIORITY
note: PRIORITY must be anywhere from A to Z."
@@ -1367,9 +1371,9 @@ note: PRIORITY must be anywhere from A to Z."
fi
if [ "$oldpri" != "$newpri" ]; then
sed -i.bak -e $item"s/^(.) //" -e $item"s/^/($newpri) /" "$TODO_FILE"
sed -i.bak -e "${item}s/^(.) //" -e "${item}s/^/($newpri) /" "$TODO_FILE"
fi
if [ $TODOTXT_VERBOSE -gt 0 ]; then
if [ "$TODOTXT_VERBOSE" -gt 0 ]; then
getNewtodo "$item"
echo "$item $newtodo"
if [ "$oldpri" != "$newpri" ]; then
@@ -1403,12 +1407,12 @@ note: PRIORITY must be anywhere from A to Z."
LASTDATA=${LASTREPORT#* } # Strip timestamp.
if [ "$LASTDATA" = "$NEWDATA" ]; then
echo "$LASTREPORT"
[ $TODOTXT_VERBOSE -gt 0 ] && echo "TODO: Report file is up-to-date."
[ "$TODOTXT_VERBOSE" -gt 0 ] && echo "TODO: Report file is up-to-date."
else
NEWREPORT="$(date +%Y-%m-%dT%T) ${NEWDATA}"
echo "${NEWREPORT}" >> "$REPORT_FILE"
echo "${NEWREPORT}"
[ $TODOTXT_VERBOSE -gt 0 ] && echo "TODO: Report file updated."
[ "$TODOTXT_VERBOSE" -gt 0 ] && echo "TODO: Report file updated."
fi
;;
@@ -1461,9 +1465,9 @@ note: PRIORITY must be anywhere from A to Z."
cd "$TODO_ACTIONS_DIR" || exit $?
for action in *
do
if [ -f "$action" -a -x "$action" ]; then
if [ -f "$action" ] && [ -x "$action" ]; then
echo "$action"
elif [ -d "$action" -a -x "$action/$action" ]; then
elif [ -d "$action" ] && [ -x "$action/$action" ]; then
echo "$action"
fi
done