Browse code

Remove unused code

Jaidyn Levesque authored on 2020-01-26 07:36:03
Showing 1 changed files
... ...
@@ -34,14 +34,6 @@ function subtract {
34 34
 	| bc 
35 35
 }
36 36
 
37
-# Multiply two numbers
38
-function multiply {
39
-	local a="$1"; local b="$2"
40
-	echo "$a * $b" \
41
-	| bc 
42
-}
43
-
44
-
45 37
 # Increment a number by one
46 38
 function inc {
47 39
 	local a="$1"
... ...
@@ -84,11 +76,6 @@ function today {
84 76
 	date +"%Y-%m-%d"
85 77
 }
86 78
 
87
-# Return current time, HH:MM
88
-function now {
89
-	date +"%H:%M"
90
-}
91
-
92 79
 
93 80
 # Return the day of a given date
94 81
 function date_day {
... ...
@@ -112,48 +99,6 @@ function date_year {
112 99
 }
113 100
 
114 101
 
115
-# Return the hour of a given time
116
-function time_hour {
117
-	local time="$1"
118
-	echo "$time" \
119
-	| awk -F ":" '{print $1}'
120
-}
121
-
122
-# Return the minute of a given time
123
-function time_minute {
124
-	local time="$1"
125
-	echo "$time" \
126
-	| awk -F ":" '{print $2}'
127
-}
128
-
129
-
130
-# Return current year
131
-function this_year {
132
-	date_year "$(today)"
133
-}
134
-
135
-# Return current month
136
-function this_month {
137
-	date_month "$(today)"
138
-}
139
-
140
-# Return current day
141
-function this_day {
142
-	date_day "$(today)"
143
-}
144
-
145
-
146
-# Return current hour
147
-function this_hour {
148
-	time_hour "$(now)"
149
-}
150
-
151
-# Return current minute
152
-function this_minute  {
153
-	time_minute "$(now)"
154
-}
155
-
156
-
157 102
 # Return how many days ought to be in the given month
158 103
 function month_days {
159 104
 	local month="$1"
... ...
@@ -257,11 +202,12 @@ function preprocess_todo {
257 202
 
258 203
 # Replace piped todo's vague dates with current dates
259 204
 function demystify_todo_times {
260
-	sed 's%^\*-%'"$(this_year)"'-%g' \
261
-	| sed 's%-\*-%-'"$(this_month)"'-%g' \
262
-	| sed 's%-\*%-'"$(this_day)"'%g' \
263
-	| sed 's%\*:%'"$(this_hour)"':%g' \
264
-	| sed 's%:\*%:'"$(this_minute)"'%g'
205
+	local year="$(date_year "$(today)")"
206
+	local month="$(date_month "$(today)")"
207
+	local day="$(date_day "$(today)")"
208
+	sed 's%^\*-%'"$year"'-%g' \
209
+	| sed 's%-\*-%-'"$month"'-%g' \
210
+	| sed 's%-\*%-'"$day"'%g'
265 211
 }
266 212
 
267 213
 # Filter out comments and blank lines from piped todo
... ...
@@ -290,7 +236,12 @@ function upcoming_todo_lines {
290 236
 		cat "$todo_file" \
291 237
 		| preprocess_todo \
292 238
 		| date_todo_lines "$(add_days "$start_date" "$i")"
293
-		if test "$?" -eq 0 -a "$i" -ne "$(dec "$limit")"; then echo "---"; fi
239
+
240
+		if test "$?" -eq 0 \
241
+			-a "$i" -ne "$(dec "$limit")" \
242
+			-a "$QUIET_MODE" -ne 0
243
+		then	echo "---"; fi
244
+
294 245
 		i="$(inc "$i")"
295 246
 	done
296 247
 }