doing 1.0.86 → 1.0.90
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/bin/doing +124 -19
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +82 -21
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce98503c379e1c769b36a26ed4f2efc9d1871c60abd67a18152db3862e1664c4
|
4
|
+
data.tar.gz: a4783a52a345f7676e08b53d9a06e4b5170ab5ff0f0d52e2ac45bcf7d6dc87f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2166477e4557597bbc5ad81bb94b73a2ec6c1c4ebdb98ac3d7ef860ddb9e6baf1998dd61accc9d336bd59003a77f7486b31edd1c818bab24b9e9ddb44608c7f
|
7
|
+
data.tar.gz: bfba29c14482747cf3150d31d44ccf43038e41c40876b37ebbb2c8c5e1aeb0dc3c0365125c0ef6a53e79d790893c4670a97e55051b06b3292ec4d2040799f15f
|
data/README.md
CHANGED
@@ -27,7 +27,7 @@ If there's something I want to look at later but doesn't need to be added to a t
|
|
27
27
|
|
28
28
|
## Installation
|
29
29
|
|
30
|
-
The current version of `doing` is <!--VER-->1.0.
|
30
|
+
The current version of `doing` is <!--VER-->1.0.89<!--END VER-->.
|
31
31
|
|
32
32
|
$ [sudo] gem install doing
|
33
33
|
|
@@ -545,6 +545,8 @@ If you have a use for it, you can use `-o csv` on the show or view commands to o
|
|
545
545
|
|
546
546
|
`doing yesterday` is great for stand-ups (thanks to [Sean Collins](https://github.com/sc68cal) for that!). Note that you can show yesterday's activity from an alternate section by using the section name as an argument (e.g. `doing yesterday archive`).
|
547
547
|
|
548
|
+
All of the display commands (view, show, today, yesterday, search) support date ranges in addition to other filtering options. Results can be narrowed to a date/time span using `--before DATE` and `--after DATE`. The `DATE` accepts a natural language string but works best in formats like `10/20/21` or `2021-05-13 3pm` (or shortened to just `5/13 3pm`). For the `today` and `yesterday` commands the `DATE` should just be a time, e.g. `12pm` or `15:00`, and results will be filtered within the timespan for just that day. Both flags are optional, and you can use just `--before` to get everything older than a certain date, or use just `--after` to get everything newer.
|
549
|
+
|
548
550
|
`doing on` allows for full date ranges and filtering. `doing on saturday`, or `doing on one month to today` will give you ranges. You can use the same terms with the `show` command by adding the `-f` or `--from` flag. `doing show @done --from "monday to friday"` will give you all of your completed items for the last week (assuming it's the weekend). There's also `doing since` a simple alias for `doing on PAST_DATE to now`, e.g. `doing since monday`.
|
549
551
|
|
550
552
|
You can also show entries matching a search string with `doing grep` (synonym `doing search`). If you want to search with regular expressions or for an exact match, surround your search query with forward slashes, e.g. `doing search /project name/`. If you pass a search string without slashes, it's treated as a fuzzy search string, meaning matches can be found as long as the characters in the search string are in order and with no more than three other characters between each. By default searches are across all sections, but you can limit it to one with the `-s SECTION_NAME` flag. Searches can be displayed with the default template, or output as HTML, CSV, or JSON.
|
data/bin/doing
CHANGED
@@ -292,10 +292,13 @@ command :select do |c|
|
|
292
292
|
c.arg_name 'SECTION'
|
293
293
|
c.flag %i[m move]
|
294
294
|
|
295
|
-
c.desc 'Initial search query for filtering'
|
295
|
+
c.desc 'Initial search query for filtering. Matching is fuzzy. For exact matching, start query with a single quote, e.g. `--query "\'search"'
|
296
296
|
c.arg_name 'QUERY'
|
297
297
|
c.flag %i[q query]
|
298
298
|
|
299
|
+
c.desc 'Use --no-menu to skip the interactive menu. Use with --query to filter items and act on results automatically. Test with `--output doing` to preview matches.'
|
300
|
+
c.switch %i[menu], negatable: true, default_value: true
|
301
|
+
|
299
302
|
c.desc 'Cancel selected items (add @done without timestamp)'
|
300
303
|
c.switch %i[c cancel], negatable: false, default_value: false
|
301
304
|
|
@@ -311,7 +314,7 @@ command :select do |c|
|
|
311
314
|
c.desc 'Add flag to selected item(s)'
|
312
315
|
c.switch %i[flag], negatable: false, default_value: false
|
313
316
|
|
314
|
-
c.desc 'Perform action without confirmation'
|
317
|
+
c.desc 'Perform action without confirmation.'
|
315
318
|
c.switch %i[force], negatable: false, default_value: false
|
316
319
|
|
317
320
|
c.desc 'Save selected entries to file using --output format'
|
@@ -323,6 +326,8 @@ command :select do |c|
|
|
323
326
|
c.flag %i[o output], must_match: /^(?:doing|taskpaper|html|csv|json|template|timeline)$/i
|
324
327
|
|
325
328
|
c.action do |_global_options, options, args|
|
329
|
+
exit_now! "--no-menu requires --query" if !options[:menu] && !options[:query]
|
330
|
+
|
326
331
|
wwid.interactive(options)
|
327
332
|
end
|
328
333
|
end
|
@@ -599,7 +604,7 @@ command :finish do |c|
|
|
599
604
|
c.switch %i[u unfinished], negatable: false, default_value: false
|
600
605
|
|
601
606
|
c.desc %(Auto-generate finish dates from next entry's start time.
|
602
|
-
Automatically generate completion dates 1 minute before next
|
607
|
+
Automatically generate completion dates 1 minute before next item (in any section) began.
|
603
608
|
--auto overrides the --date and --back parameters.)
|
604
609
|
c.switch [:auto], negatable: false, default_value: false
|
605
610
|
|
@@ -896,10 +901,22 @@ command :show do |c|
|
|
896
901
|
c.arg_name 'MAX'
|
897
902
|
c.flag %i[c count], default_value: 0
|
898
903
|
|
899
|
-
c.desc 'Age (oldest
|
904
|
+
c.desc 'Age (oldest|newest)'
|
900
905
|
c.arg_name 'AGE'
|
901
906
|
c.flag %i[a age], default_value: 'newest'
|
902
907
|
|
908
|
+
c.desc 'View entries older than date'
|
909
|
+
c.arg_name 'DATE_STRING'
|
910
|
+
c.flag [:before]
|
911
|
+
|
912
|
+
c.desc 'View entries newer than date'
|
913
|
+
c.arg_name 'DATE_STRING'
|
914
|
+
c.flag [:after]
|
915
|
+
|
916
|
+
c.desc 'Search filter, surround with slashes for regex (/query/)'
|
917
|
+
c.arg_name 'QUERY'
|
918
|
+
c.flag [:search]
|
919
|
+
|
903
920
|
c.desc 'Sort order (asc/desc)'
|
904
921
|
c.arg_name 'ORDER'
|
905
922
|
c.flag %i[s sort], must_match: /^[ad].*/i, default_value: 'ASC'
|
@@ -924,6 +941,10 @@ command :show do |c|
|
|
924
941
|
c.arg_name 'KEY'
|
925
942
|
c.flag [:tag_sort], must_match: /^(?:name|time)/i, default_value: default
|
926
943
|
|
944
|
+
c.desc 'Tag sort direction (asc|desc)'
|
945
|
+
c.arg_name 'DIRECTION'
|
946
|
+
c.flag [:tag_order], must_match: /^(?:a(?:sc)?|d(?:esc)?)$/i
|
947
|
+
|
927
948
|
c.desc 'Only show items with recorded time intervals'
|
928
949
|
c.switch [:only_timed], default_value: false, negatable: false
|
929
950
|
|
@@ -979,8 +1000,8 @@ command :show do |c|
|
|
979
1000
|
}
|
980
1001
|
end
|
981
1002
|
|
982
|
-
if options[:
|
983
|
-
date_string = options[:
|
1003
|
+
if options[:from]
|
1004
|
+
date_string = options[:from]
|
984
1005
|
if date_string =~ / (to|through|thru|(un)?til|-+) /
|
985
1006
|
dates = date_string.split(/ (to|through|thru|(un)?til|-+) /)
|
986
1007
|
start = wwid.chronify(dates[0])
|
@@ -993,22 +1014,31 @@ command :show do |c|
|
|
993
1014
|
dates = [start, finish]
|
994
1015
|
end
|
995
1016
|
|
996
|
-
options[:
|
1017
|
+
options[:times] = true if options[:totals]
|
997
1018
|
|
998
1019
|
tags_color = wwid.config.key?('tags_color') ? wwid.config['tags_color'] : nil
|
999
1020
|
|
1000
1021
|
options[:sort_tags] = options[:tag_sort] =~ /^n/i
|
1022
|
+
tag_order = if options[:tag_order]
|
1023
|
+
options[:tag_order] =~ /^d/i ? 'desc' : 'asc'
|
1024
|
+
else
|
1025
|
+
'asc'
|
1026
|
+
end
|
1001
1027
|
opts = {
|
1002
|
-
|
1028
|
+
after: options[:after],
|
1029
|
+
age: options[:age],
|
1030
|
+
before: options[:before],
|
1003
1031
|
count: options[:c].to_i,
|
1004
1032
|
date_filter: dates,
|
1005
1033
|
highlight: true,
|
1006
1034
|
only_timed: options[:only_timed],
|
1007
1035
|
order: options[:s],
|
1008
1036
|
output: options[:output],
|
1037
|
+
search: options[:search],
|
1009
1038
|
section: section,
|
1010
1039
|
sort_tags: options[:sort_tags],
|
1011
1040
|
tag_filter: tag_filter,
|
1041
|
+
tag_order: tag_order,
|
1012
1042
|
tags_color: tags_color,
|
1013
1043
|
times: options[:t],
|
1014
1044
|
totals: options[:totals]
|
@@ -1030,6 +1060,14 @@ command [:grep, :search] do |c|
|
|
1030
1060
|
c.arg_name 'NAME'
|
1031
1061
|
c.flag %i[s section], default_value: 'All'
|
1032
1062
|
|
1063
|
+
c.desc 'Constrain search to entries older than date'
|
1064
|
+
c.arg_name 'DATE_STRING'
|
1065
|
+
c.flag [:before]
|
1066
|
+
|
1067
|
+
c.desc 'Constrain search to entries newer than date'
|
1068
|
+
c.arg_name 'DATE_STRING'
|
1069
|
+
c.flag [:after]
|
1070
|
+
|
1033
1071
|
c.desc 'Output to export format (csv|html|json|template|timeline)'
|
1034
1072
|
c.arg_name 'FORMAT'
|
1035
1073
|
c.flag %i[o output], must_match: /^(?:template|html|csv|json|timeline)$/i
|
@@ -1054,10 +1092,12 @@ command [:grep, :search] do |c|
|
|
1054
1092
|
|
1055
1093
|
section = wwid.guess_section(options[:s]) if options[:s]
|
1056
1094
|
|
1057
|
-
options[:
|
1095
|
+
options[:times] = true if options[:totals]
|
1058
1096
|
options[:sort_tags] = options[:tag_sort] =~ /^n/i
|
1059
1097
|
|
1060
1098
|
opts = {
|
1099
|
+
after: options[:after],
|
1100
|
+
before: options[:before],
|
1061
1101
|
highlight: true,
|
1062
1102
|
only_timed: options[:only_timed],
|
1063
1103
|
output: options[:output],
|
@@ -1065,7 +1105,7 @@ command [:grep, :search] do |c|
|
|
1065
1105
|
section: section,
|
1066
1106
|
sort_tags: options[:sort_tags],
|
1067
1107
|
tags_color: tags_color,
|
1068
|
-
times: options[:
|
1108
|
+
times: options[:times],
|
1069
1109
|
totals: options[:totals]
|
1070
1110
|
}
|
1071
1111
|
|
@@ -1142,12 +1182,25 @@ command :today do |c|
|
|
1142
1182
|
c.arg_name 'FORMAT'
|
1143
1183
|
c.flag %i[o output], must_match: /^(?:template|html|csv|json|timeline)$/i
|
1144
1184
|
|
1185
|
+
c.desc 'View entries before specified time (e.g. 8am, 12:30pm, 15:00)'
|
1186
|
+
c.arg_name 'TIME_STRING'
|
1187
|
+
c.flag [:before]
|
1188
|
+
|
1189
|
+
c.desc 'View entries after specified time (e.g. 8am, 12:30pm, 15:00)'
|
1190
|
+
c.arg_name 'TIME_STRING'
|
1191
|
+
c.flag [:after]
|
1192
|
+
|
1145
1193
|
c.action do |_global_options, options, _args|
|
1146
1194
|
options[:t] = true if options[:totals]
|
1147
1195
|
options[:sort_tags] = options[:tag_sort] =~ /^n/i
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1196
|
+
opt = {
|
1197
|
+
after: options[:after],
|
1198
|
+
before: options[:before],
|
1199
|
+
section: options[:section],
|
1200
|
+
sort_tags: options[:sort_tags],
|
1201
|
+
totals: options[:totals]
|
1202
|
+
}
|
1203
|
+
puts wwid.today(options[:times], options[:output], opt).chomp
|
1151
1204
|
end
|
1152
1205
|
end
|
1153
1206
|
|
@@ -1276,10 +1329,33 @@ command :yesterday do |c|
|
|
1276
1329
|
c.arg_name 'KEY'
|
1277
1330
|
c.flag [:tag_sort], must_match: /^(?:name|time)$/i, default_value: default
|
1278
1331
|
|
1332
|
+
c.desc 'View entries before specified time (e.g. 8am, 12:30pm, 15:00)'
|
1333
|
+
c.arg_name 'TIME_STRING'
|
1334
|
+
c.flag [:before]
|
1335
|
+
|
1336
|
+
c.desc 'View entries after specified time (e.g. 8am, 12:30pm, 15:00)'
|
1337
|
+
c.arg_name 'TIME_STRING'
|
1338
|
+
c.flag [:after]
|
1339
|
+
|
1340
|
+
c.desc 'Tag sort direction (asc|desc)'
|
1341
|
+
c.arg_name 'DIRECTION'
|
1342
|
+
c.flag [:tag_order], must_match: /^(?:a(?:sc)?|d(?:esc)?)$/i
|
1343
|
+
|
1279
1344
|
c.action do |_global_options, options, _args|
|
1345
|
+
tag_order = if options[:tag_order]
|
1346
|
+
options[:tag_order] =~ /^d/i ? 'desc' : 'asc'
|
1347
|
+
else
|
1348
|
+
'asc'
|
1349
|
+
end
|
1280
1350
|
options[:sort_tags] = options[:tag_sort] =~ /^n/i
|
1281
|
-
|
1282
|
-
|
1351
|
+
opt = {
|
1352
|
+
after: options[:after],
|
1353
|
+
before: options[:before],
|
1354
|
+
sort_tags: options[:sort_tags],
|
1355
|
+
tag_order: options[:tag_order],
|
1356
|
+
totals: options[:totals]
|
1357
|
+
}
|
1358
|
+
puts wwid.yesterday(options[:section], options[:times], options[:output], opt).chomp
|
1283
1359
|
end
|
1284
1360
|
end
|
1285
1361
|
|
@@ -1381,7 +1457,7 @@ command :colors do |c|
|
|
1381
1457
|
end
|
1382
1458
|
|
1383
1459
|
desc 'Display a user-created view'
|
1384
|
-
long_desc 'Command line options override
|
1460
|
+
long_desc 'Command line options override view configuration'
|
1385
1461
|
arg_name 'VIEW_NAME'
|
1386
1462
|
command :view do |c|
|
1387
1463
|
c.desc 'Section'
|
@@ -1405,6 +1481,18 @@ command :view do |c|
|
|
1405
1481
|
c.desc 'Include colors in output'
|
1406
1482
|
c.switch [:color], default_value: true, negatable: true
|
1407
1483
|
|
1484
|
+
c.desc 'Tag filter, combine multiple tags with a comma.'
|
1485
|
+
c.arg_name 'TAG'
|
1486
|
+
c.flag [:tag]
|
1487
|
+
|
1488
|
+
c.desc 'Tag boolean (AND,OR,NOT)'
|
1489
|
+
c.arg_name 'BOOLEAN'
|
1490
|
+
c.flag %i[b bool], must_match: /(?:and|all|any|or|not|none)/i, default_value: 'OR'
|
1491
|
+
|
1492
|
+
c.desc 'Search filter, surround with slashes for regex (/query/)'
|
1493
|
+
c.arg_name 'QUERY'
|
1494
|
+
c.flag [:search]
|
1495
|
+
|
1408
1496
|
c.desc 'Sort tags by (name|time)'
|
1409
1497
|
c.arg_name 'KEY'
|
1410
1498
|
c.flag [:tag_sort], must_match: /^(?:name|time)$/i
|
@@ -1413,10 +1501,20 @@ command :view do |c|
|
|
1413
1501
|
c.arg_name 'DIRECTION'
|
1414
1502
|
c.flag [:tag_order], must_match: /^(?:a(?:sc)?|d(?:esc)?)$/i
|
1415
1503
|
|
1504
|
+
c.desc 'View entries older than date'
|
1505
|
+
c.arg_name 'DATE_STRING'
|
1506
|
+
c.flag [:before]
|
1507
|
+
|
1508
|
+
c.desc 'View entries newer than date'
|
1509
|
+
c.arg_name 'DATE_STRING'
|
1510
|
+
c.flag [:after]
|
1511
|
+
|
1416
1512
|
c.desc 'Only show items with recorded time intervals (override view settings)'
|
1417
1513
|
c.switch [:only_timed], default_value: false, negatable: false
|
1418
1514
|
|
1419
1515
|
c.action do |_global_options, options, args|
|
1516
|
+
exit_now! '--tag and --search cannot be used together' if options[:tag] && options[:search]
|
1517
|
+
|
1420
1518
|
title = if args.empty?
|
1421
1519
|
wwid.choose_view
|
1422
1520
|
else
|
@@ -1441,7 +1539,11 @@ command :view do |c|
|
|
1441
1539
|
format = view.key?('date_format') ? view['date_format'] : nil
|
1442
1540
|
tags_color = view.key?('tags_color') ? view['tags_color'] : nil
|
1443
1541
|
tag_filter = false
|
1444
|
-
if
|
1542
|
+
if options[:tag]
|
1543
|
+
tag_filter = { 'tags' => [], 'bool' => 'OR' }
|
1544
|
+
tag_filter['tags'] = options[:tag].gsub(/[, ]+/, ' ').split(' ').map(&:strip)
|
1545
|
+
tag_filter['bool'] = options[:bool].normalize_bool
|
1546
|
+
elsif view.key?('tags') && !(view['tags'].nil? || view['tags'].empty?)
|
1445
1547
|
tag_filter = { 'tags' => [], 'bool' => 'OR' }
|
1446
1548
|
tag_filter['tags'] = if view['tags'].instance_of?(Array)
|
1447
1549
|
view['tags'].map(&:strip)
|
@@ -1490,14 +1592,17 @@ command :view do |c|
|
|
1490
1592
|
else
|
1491
1593
|
'asc'
|
1492
1594
|
end
|
1493
|
-
|
1595
|
+
|
1494
1596
|
opts = {
|
1597
|
+
after: options[:after],
|
1598
|
+
before: options[:before],
|
1495
1599
|
count: count,
|
1496
1600
|
format: format,
|
1497
1601
|
highlight: options[:color],
|
1498
1602
|
only_timed: only_timed,
|
1499
1603
|
order: order,
|
1500
|
-
output: options[:
|
1604
|
+
output: options[:output],
|
1605
|
+
search: options[:search],
|
1501
1606
|
section: section,
|
1502
1607
|
sort_tags: options[:sort_tags],
|
1503
1608
|
tag_filter: tag_filter,
|
data/lib/doing/version.rb
CHANGED
data/lib/doing/wwid.rb
CHANGED
@@ -817,7 +817,7 @@ class WWID
|
|
817
817
|
' | ',
|
818
818
|
item['title']
|
819
819
|
]
|
820
|
-
if
|
820
|
+
if section =~ /^all/i
|
821
821
|
out.concat([
|
822
822
|
' (',
|
823
823
|
item['section'],
|
@@ -834,6 +834,12 @@ class WWID
|
|
834
834
|
'--bind ctrl-a:select-all',
|
835
835
|
%(-q "#{opt[:query]}")
|
836
836
|
]
|
837
|
+
if !opt[:menu]
|
838
|
+
exit_now! "Can't skip menu when no query is provided" unless opt[:query]
|
839
|
+
|
840
|
+
fzf_args.concat([%(--filter="#{opt[:query]}"), '--no-sort'])
|
841
|
+
end
|
842
|
+
|
837
843
|
res = `echo #{Shellwords.escape(options.join("\n"))}|#{fzf} #{fzf_args.join(' ')}`
|
838
844
|
selected = []
|
839
845
|
res.split(/\n/).each do |item|
|
@@ -879,8 +885,7 @@ class WWID
|
|
879
885
|
when /(add|remove) tag/
|
880
886
|
type = action =~ /^add/ ? 'add' : 'remove'
|
881
887
|
if opt[:tag]
|
882
|
-
|
883
|
-
Process.exit 1
|
888
|
+
exit_now! "'add tag' and 'remove tag' can not be used together"
|
884
889
|
end
|
885
890
|
print "#{colors['yellow']}Tag to #{type}: #{colors['reset']}"
|
886
891
|
tag = STDIN.gets
|
@@ -1120,7 +1125,12 @@ class WWID
|
|
1120
1125
|
else
|
1121
1126
|
if opt[:sequential]
|
1122
1127
|
next_entry = next_item(item)
|
1123
|
-
|
1128
|
+
|
1129
|
+
if next_entry.nil?
|
1130
|
+
done_date = Time.now
|
1131
|
+
else
|
1132
|
+
done_date = next_entry['date'] - 60
|
1133
|
+
end
|
1124
1134
|
elsif opt[:took]
|
1125
1135
|
if item['date'] + opt[:took] > Time.now
|
1126
1136
|
item['date'] = Time.now - opt[:took]
|
@@ -1215,13 +1225,15 @@ class WWID
|
|
1215
1225
|
## @param old_item
|
1216
1226
|
##
|
1217
1227
|
def next_item(old_item)
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1228
|
+
combined = { 'items' => [] }
|
1229
|
+
@content.each do |_k, v|
|
1230
|
+
combined['items'] += v['items']
|
1231
|
+
end
|
1232
|
+
items = combined['items'].dup.sort_by { |item| item['date'] }.reverse
|
1233
|
+
idx = items.index(old_item)
|
1222
1234
|
|
1223
|
-
if
|
1224
|
-
|
1235
|
+
if idx > 0
|
1236
|
+
items[idx - 1]
|
1225
1237
|
else
|
1226
1238
|
nil
|
1227
1239
|
end
|
@@ -1742,6 +1754,24 @@ class WWID
|
|
1742
1754
|
end
|
1743
1755
|
end
|
1744
1756
|
|
1757
|
+
if opt[:before]
|
1758
|
+
time_string = opt[:before]
|
1759
|
+
time_string += ' 12am' if time_string !~ /(\d+:\d+|\d+[ap])/
|
1760
|
+
cutoff = chronify(time_string)
|
1761
|
+
if cutoff
|
1762
|
+
items.delete_if { |item| item['date'] >= cutoff }
|
1763
|
+
end
|
1764
|
+
end
|
1765
|
+
|
1766
|
+
if opt[:after]
|
1767
|
+
time_string = opt[:after]
|
1768
|
+
time_string += ' 11:59pm' if time_string !~ /(\d+:\d+|\d+[ap])/
|
1769
|
+
cutoff = chronify(time_string)
|
1770
|
+
if cutoff
|
1771
|
+
items.delete_if { |item| item['date'] <= cutoff }
|
1772
|
+
end
|
1773
|
+
end
|
1774
|
+
|
1745
1775
|
if opt[:today]
|
1746
1776
|
items.delete_if do |item|
|
1747
1777
|
item['date'] < Date.today.to_time
|
@@ -1838,11 +1868,11 @@ class WWID
|
|
1838
1868
|
end
|
1839
1869
|
end
|
1840
1870
|
if opt[:output] == 'json'
|
1841
|
-
|
1871
|
+
puts JSON.pretty_generate({
|
1842
1872
|
'section' => section,
|
1843
1873
|
'items' => items_out,
|
1844
1874
|
'timers' => tag_times(format: 'json', sort_by_name: opt[:sort_tags], sort_order: opt[:tag_order])
|
1845
|
-
}
|
1875
|
+
})
|
1846
1876
|
elsif opt[:output] == 'timeline'
|
1847
1877
|
template = <<~EOTEMPLATE
|
1848
1878
|
<!doctype html>
|
@@ -1969,13 +1999,13 @@ class WWID
|
|
1969
1999
|
|
1970
2000
|
output.sub!(/%shortdate/) do
|
1971
2001
|
if item['date'] > Date.today.to_time
|
1972
|
-
item['date'].strftime('%_I:%M%P')
|
1973
|
-
elsif item['date'] > (Date.today -
|
1974
|
-
item['date'].strftime('%a
|
2002
|
+
item['date'].strftime(' %_I:%M%P')
|
2003
|
+
elsif item['date'] > (Date.today - 6).to_time
|
2004
|
+
item['date'].strftime('%a %_I:%M%P')
|
1975
2005
|
elsif item['date'].year == Date.today.year
|
1976
|
-
item['date'].strftime('%
|
2006
|
+
item['date'].strftime('%m/%d %_I:%M%P')
|
1977
2007
|
else
|
1978
|
-
item['date'].strftime('%
|
2008
|
+
item['date'].strftime('%m/%d/%Y %_I:%M%P')
|
1979
2009
|
end
|
1980
2010
|
end
|
1981
2011
|
|
@@ -2189,8 +2219,22 @@ class WWID
|
|
2189
2219
|
opt[:sort_tags] ||= false
|
2190
2220
|
|
2191
2221
|
cfg = @config['templates']['today']
|
2192
|
-
|
2193
|
-
|
2222
|
+
options = {
|
2223
|
+
after: opt[:after],
|
2224
|
+
before: opt[:before],
|
2225
|
+
count: 0,
|
2226
|
+
format: cfg['date_format'],
|
2227
|
+
order: 'asc',
|
2228
|
+
output: output,
|
2229
|
+
section: opt[:section],
|
2230
|
+
sort_tags: opt[:sort_tags],
|
2231
|
+
template: cfg['template'],
|
2232
|
+
times: times,
|
2233
|
+
today: true,
|
2234
|
+
totals: opt[:totals],
|
2235
|
+
wrap_width: cfg['wrap_width']
|
2236
|
+
}
|
2237
|
+
list_section(options)
|
2194
2238
|
end
|
2195
2239
|
|
2196
2240
|
##
|
@@ -2225,8 +2269,25 @@ class WWID
|
|
2225
2269
|
opt[:totals] ||= false
|
2226
2270
|
opt[:sort_tags] ||= false
|
2227
2271
|
section = guess_section(section)
|
2228
|
-
|
2229
|
-
|
2272
|
+
y = (Time.now - (60 * 60 * 24)).strftime('%Y-%m-%d')
|
2273
|
+
opt[:after] = "#{y} #{opt[:after]}" if opt[:after]
|
2274
|
+
opt[:before] = "#{y} #{opt[:before]}" if opt[:before]
|
2275
|
+
|
2276
|
+
options = {
|
2277
|
+
after: opt[:after],
|
2278
|
+
before: opt[:before],
|
2279
|
+
count: 0,
|
2280
|
+
order: 'asc',
|
2281
|
+
output: output,
|
2282
|
+
section: section,
|
2283
|
+
sort_tags: opt[:sort_tags],
|
2284
|
+
tag_order: opt[:tag_order],
|
2285
|
+
times: times,
|
2286
|
+
totals: opt[:totals],
|
2287
|
+
yesterday: true
|
2288
|
+
}
|
2289
|
+
|
2290
|
+
list_section(options)
|
2230
2291
|
end
|
2231
2292
|
|
2232
2293
|
##
|