Remove unused code

This commit is contained in:
Jaidyn Levesque 2020-01-26 01:36:03 -06:00
parent 5a47c9a5c5
commit a6ca4f2513

View File

@ -34,14 +34,6 @@ function subtract {
| bc | bc
} }
# Multiply two numbers
function multiply {
local a="$1"; local b="$2"
echo "$a * $b" \
| bc
}
# Increment a number by one # Increment a number by one
function inc { function inc {
local a="$1" local a="$1"
@ -84,11 +76,6 @@ function today {
date +"%Y-%m-%d" date +"%Y-%m-%d"
} }
# Return current time, HH:MM
function now {
date +"%H:%M"
}
# Return the day of a given date # Return the day of a given date
function date_day { function date_day {
@ -112,48 +99,6 @@ function date_year {
} }
# Return the hour of a given time
function time_hour {
local time="$1"
echo "$time" \
| awk -F ":" '{print $1}'
}
# Return the minute of a given time
function time_minute {
local time="$1"
echo "$time" \
| awk -F ":" '{print $2}'
}
# Return current year
function this_year {
date_year "$(today)"
}
# Return current month
function this_month {
date_month "$(today)"
}
# Return current day
function this_day {
date_day "$(today)"
}
# Return current hour
function this_hour {
time_hour "$(now)"
}
# Return current minute
function this_minute {
time_minute "$(now)"
}
# Return how many days ought to be in the given month # Return how many days ought to be in the given month
function month_days { function month_days {
local month="$1" local month="$1"
@ -257,11 +202,12 @@ function preprocess_todo {
# Replace piped todo's vague dates with current dates # Replace piped todo's vague dates with current dates
function demystify_todo_times { function demystify_todo_times {
sed 's%^\*-%'"$(this_year)"'-%g' \ local year="$(date_year "$(today)")"
| sed 's%-\*-%-'"$(this_month)"'-%g' \ local month="$(date_month "$(today)")"
| sed 's%-\*%-'"$(this_day)"'%g' \ local day="$(date_day "$(today)")"
| sed 's%\*:%'"$(this_hour)"':%g' \ sed 's%^\*-%'"$year"'-%g' \
| sed 's%:\*%:'"$(this_minute)"'%g' | sed 's%-\*-%-'"$month"'-%g' \
| sed 's%-\*%-'"$day"'%g'
} }
# Filter out comments and blank lines from piped todo # Filter out comments and blank lines from piped todo
@ -290,7 +236,12 @@ function upcoming_todo_lines {
cat "$todo_file" \ cat "$todo_file" \
| preprocess_todo \ | preprocess_todo \
| date_todo_lines "$(add_days "$start_date" "$i")" | date_todo_lines "$(add_days "$start_date" "$i")"
if test "$?" -eq 0 -a "$i" -ne "$(dec "$limit")"; then echo "---"; fi
if test "$?" -eq 0 \
-a "$i" -ne "$(dec "$limit")" \
-a "$QUIET_MODE" -ne 0
then echo "---"; fi
i="$(inc "$i")" i="$(inc "$i")"
done done
} }