doing 2.1.1pre → 2.1.2pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardoc/checksums +5 -5
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/bin/doing +61 -11
- data/doc/Array.html +1 -1
- data/doc/Doing/Color.html +1 -1
- data/doc/Doing/Completion.html +1 -1
- data/doc/Doing/Configuration.html +8 -7
- data/doc/Doing/Errors/DoingNoTraceError.html +1 -1
- data/doc/Doing/Errors/DoingRuntimeError.html +1 -1
- data/doc/Doing/Errors/DoingStandardError.html +1 -1
- data/doc/Doing/Errors/EmptyInput.html +1 -1
- data/doc/Doing/Errors/NoResults.html +1 -1
- data/doc/Doing/Errors/PluginException.html +1 -1
- data/doc/Doing/Errors/UserCancelled.html +1 -1
- data/doc/Doing/Errors/WrongCommand.html +1 -1
- data/doc/Doing/Errors.html +1 -1
- data/doc/Doing/Hooks.html +1 -1
- data/doc/Doing/Item.html +47 -2
- data/doc/Doing/Items.html +1 -1
- data/doc/Doing/LogAdapter.html +1 -1
- data/doc/Doing/Note.html +1 -1
- data/doc/Doing/Pager.html +1 -1
- data/doc/Doing/Plugins.html +1 -1
- data/doc/Doing/Prompt.html +1 -1
- data/doc/Doing/Section.html +1 -1
- data/doc/Doing/Util.html +1 -1
- data/doc/Doing/WWID.html +1 -1
- data/doc/Doing.html +2 -2
- data/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
- data/doc/GLI/Commands.html +1 -1
- data/doc/GLI.html +1 -1
- data/doc/Hash.html +1 -1
- data/doc/Status.html +1 -1
- data/doc/String.html +1 -1
- data/doc/Symbol.html +1 -1
- data/doc/Time.html +1 -1
- data/doc/_index.html +1 -1
- data/doc/file.README.html +2 -2
- data/doc/index.html +2 -2
- data/doc/method_list.html +257 -249
- data/doc/top-level-namespace.html +1 -1
- data/doing.rdoc +54 -9
- data/lib/completion/doing.bash +18 -18
- data/lib/doing/configuration.rb +19 -8
- data/lib/doing/item.rb +7 -0
- data/lib/doing/plugins/export/template_export.rb +25 -1
- data/lib/doing/prompt.rb +4 -2
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +56 -23
- metadata +2 -2
@@ -102,7 +102,7 @@
|
|
102
102
|
</div>
|
103
103
|
|
104
104
|
<div id="footer">
|
105
|
-
Generated on
|
105
|
+
Generated on Sun Nov 28 05:27:33 2021 by
|
106
106
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
107
107
|
0.9.26 (ruby-3.0.1).
|
108
108
|
</div>
|
data/doing.rdoc
CHANGED
@@ -5,7 +5,7 @@ record of what you've been doing, complete with tag-based time tracking. The
|
|
5
5
|
command line tool allows you to add entries, annotate with tags and notes, and
|
6
6
|
view your entries with myriad options, with a focus on a "natural" language syntax.
|
7
7
|
|
8
|
-
v2.1.
|
8
|
+
v2.1.2pre
|
9
9
|
|
10
10
|
=== Global Options
|
11
11
|
=== --config_file arg
|
@@ -145,7 +145,7 @@ Repeat last entry matching tags. Combine multiple tags with a comma.
|
|
145
145
|
|
146
146
|
|
147
147
|
===== -e|--editor
|
148
|
-
Edit duplicated entry with
|
148
|
+
Edit duplicated entry with vim before adding
|
149
149
|
|
150
150
|
|
151
151
|
|
@@ -541,7 +541,7 @@ Include date
|
|
541
541
|
|
542
542
|
|
543
543
|
===== -e|--editor
|
544
|
-
Edit entry with
|
544
|
+
Edit entry with vim (with no arguments, edits the last entry)
|
545
545
|
|
546
546
|
|
547
547
|
|
@@ -724,6 +724,11 @@ Sort tags by (name|time)
|
|
724
724
|
[Must Match] (?i-mx:^(?:name|time)$)
|
725
725
|
|
726
726
|
|
727
|
+
===== --[no-]duration
|
728
|
+
Show elapsed time on entries without @done tag
|
729
|
+
|
730
|
+
|
731
|
+
|
727
732
|
===== -i|--interactive
|
728
733
|
Display an interactive menu of results to perform further operations
|
729
734
|
|
@@ -902,8 +907,13 @@ Tag filter, combine multiple tags with a comma.
|
|
902
907
|
[Default Value] None
|
903
908
|
|
904
909
|
|
910
|
+
===== --[no-]duration
|
911
|
+
Show elapsed time if entry is not tagged @done
|
912
|
+
|
913
|
+
|
914
|
+
|
905
915
|
===== -e|--editor
|
906
|
-
Edit entry with
|
916
|
+
Edit entry with vim
|
907
917
|
|
908
918
|
|
909
919
|
|
@@ -937,7 +947,7 @@ Note
|
|
937
947
|
|
938
948
|
|
939
949
|
===== -e|--editor
|
940
|
-
Edit entry with
|
950
|
+
Edit entry with vim
|
941
951
|
|
942
952
|
|
943
953
|
|
@@ -1059,7 +1069,7 @@ Archive previous @meanwhile entry
|
|
1059
1069
|
|
1060
1070
|
|
1061
1071
|
===== -e|--editor
|
1062
|
-
Edit entry with
|
1072
|
+
Edit entry with vim
|
1063
1073
|
|
1064
1074
|
|
1065
1075
|
|
@@ -1110,7 +1120,7 @@ Add/remove note from last entry matching tag
|
|
1110
1120
|
|
1111
1121
|
|
1112
1122
|
===== -e|--editor
|
1113
|
-
Edit entry with
|
1123
|
+
Edit entry with vim
|
1114
1124
|
|
1115
1125
|
|
1116
1126
|
|
@@ -1141,7 +1151,7 @@ Record what you're starting now, or backdate the start time using natural langua
|
|
1141
1151
|
|
1142
1152
|
A parenthetical at the end of the entry will be converted to a note.
|
1143
1153
|
|
1144
|
-
Run with no argument to create a new entry using
|
1154
|
+
Run with no argument to create a new entry using vim.
|
1145
1155
|
===== Options
|
1146
1156
|
===== -b|--back|--started DATE_STRING
|
1147
1157
|
|
@@ -1165,7 +1175,7 @@ Section
|
|
1165
1175
|
|
1166
1176
|
|
1167
1177
|
===== -e|--editor
|
1168
|
-
Edit entry with
|
1178
|
+
Edit entry with vim
|
1169
1179
|
|
1170
1180
|
|
1171
1181
|
|
@@ -1203,6 +1213,11 @@ Sort tags by (name|time)
|
|
1203
1213
|
[Must Match] (?i-mx:^(?:name|time)$)
|
1204
1214
|
|
1205
1215
|
|
1216
|
+
===== --[no-]duration
|
1217
|
+
Show elapsed time on entries without @done tag
|
1218
|
+
|
1219
|
+
|
1220
|
+
|
1206
1221
|
===== -t|--[no-]times
|
1207
1222
|
Show time intervals on @done tasks
|
1208
1223
|
|
@@ -1281,6 +1296,11 @@ Sort tags by (name|time)
|
|
1281
1296
|
[Must Match] (?i-mx:^(?:name|time)$)
|
1282
1297
|
|
1283
1298
|
|
1299
|
+
===== --[no-]duration
|
1300
|
+
Show elapsed time on entries without @done tag
|
1301
|
+
|
1302
|
+
|
1303
|
+
|
1284
1304
|
===== -i|--interactive
|
1285
1305
|
Select from a menu of matching entries to perform additional operations
|
1286
1306
|
|
@@ -1688,6 +1708,11 @@ Sort tags by (name|time)
|
|
1688
1708
|
[Must Match] (?i-mx:^(?:name|time))
|
1689
1709
|
|
1690
1710
|
|
1711
|
+
===== --[no-]duration
|
1712
|
+
Show elapsed time on entries without @done tag
|
1713
|
+
|
1714
|
+
|
1715
|
+
|
1691
1716
|
===== -i|--interactive
|
1692
1717
|
Select from a menu of matching entries to perform additional operations
|
1693
1718
|
|
@@ -1746,6 +1771,11 @@ Sort tags by (name|time)
|
|
1746
1771
|
[Must Match] (?i-mx:^(?:name|time)$)
|
1747
1772
|
|
1748
1773
|
|
1774
|
+
===== --[no-]duration
|
1775
|
+
Show elapsed time on entries without @done tag
|
1776
|
+
|
1777
|
+
|
1778
|
+
|
1749
1779
|
===== -t|--[no-]times
|
1750
1780
|
Show time intervals on @done tasks
|
1751
1781
|
|
@@ -1939,6 +1969,11 @@ Sort tags by (name|time)
|
|
1939
1969
|
[Must Match] (?i-mx:^(?:name|time)$)
|
1940
1970
|
|
1941
1971
|
|
1972
|
+
===== --[no-]duration
|
1973
|
+
Show elapsed time on entries without @done tag
|
1974
|
+
|
1975
|
+
|
1976
|
+
|
1942
1977
|
===== -t|--[no-]times
|
1943
1978
|
Show time intervals on @done tasks
|
1944
1979
|
|
@@ -2065,6 +2100,11 @@ Include colors in output
|
|
2065
2100
|
|
2066
2101
|
|
2067
2102
|
|
2103
|
+
===== --[no-]duration
|
2104
|
+
Show elapsed time on entries without @done tag
|
2105
|
+
|
2106
|
+
|
2107
|
+
|
2068
2108
|
===== -i|--interactive
|
2069
2109
|
Select from a menu of matching entries to perform additional operations
|
2070
2110
|
|
@@ -2223,6 +2263,11 @@ Sort tags by (name|time)
|
|
2223
2263
|
[Must Match] (?i-mx:^(?:name|time)$)
|
2224
2264
|
|
2225
2265
|
|
2266
|
+
===== --[no-]duration
|
2267
|
+
Show elapsed time on entries without @done tag
|
2268
|
+
|
2269
|
+
|
2270
|
+
|
2226
2271
|
===== -t|--[no-]times
|
2227
2272
|
Show time intervals on @done tasks
|
2228
2273
|
|
data/lib/completion/doing.bash
CHANGED
@@ -101,9 +101,9 @@ _doing_finish() {
|
|
101
101
|
_doing_grep() {
|
102
102
|
|
103
103
|
if [[ "$token" == --* ]]; then
|
104
|
-
COMPREPLY=( $( compgen -W '--after --before --case --from --interactive --not --output --only_timed --section --times --tag_sort --totals --exact' -- $token ) )
|
104
|
+
COMPREPLY=( $( compgen -W '--after --before --case --duration --from --interactive --not --output --only_timed --section --times --tag_sort --totals --exact' -- $token ) )
|
105
105
|
elif [[ "$token" == -* ]]; then
|
106
|
-
COMPREPLY=( $( compgen -W '-i -o -s -t -x --after --before --case --from --interactive --not --output --only_timed --section --times --tag_sort --totals --exact' -- $token ) )
|
106
|
+
COMPREPLY=( $( compgen -W '-i -o -s -t -x --after --before --case --duration --from --interactive --not --output --only_timed --section --times --tag_sort --totals --exact' -- $token ) )
|
107
107
|
|
108
108
|
fi
|
109
109
|
}
|
@@ -131,9 +131,9 @@ _doing_import() {
|
|
131
131
|
_doing_last() {
|
132
132
|
|
133
133
|
if [[ "$token" == --* ]]; then
|
134
|
-
COMPREPLY=( $( compgen -W '--bool --case --editor --not --section --search --tag --exact' -- $token ) )
|
134
|
+
COMPREPLY=( $( compgen -W '--bool --case --duration --editor --not --section --search --tag --exact' -- $token ) )
|
135
135
|
elif [[ "$token" == -* ]]; then
|
136
|
-
COMPREPLY=( $( compgen -W '-e -s -x --bool --case --editor --not --section --search --tag --exact' -- $token ) )
|
136
|
+
COMPREPLY=( $( compgen -W '-e -s -x --bool --case --duration --editor --not --section --search --tag --exact' -- $token ) )
|
137
137
|
|
138
138
|
fi
|
139
139
|
}
|
@@ -191,9 +191,9 @@ _doing_now() {
|
|
191
191
|
_doing_on() {
|
192
192
|
|
193
193
|
if [[ "$token" == --* ]]; then
|
194
|
-
COMPREPLY=( $( compgen -W '--output --section --times --tag_sort --totals' -- $token ) )
|
194
|
+
COMPREPLY=( $( compgen -W '--duration --output --section --times --tag_sort --totals' -- $token ) )
|
195
195
|
elif [[ "$token" == -* ]]; then
|
196
|
-
COMPREPLY=( $( compgen -W '-o -s -t --output --section --times --tag_sort --totals' -- $token ) )
|
196
|
+
COMPREPLY=( $( compgen -W '-o -s -t --duration --output --section --times --tag_sort --totals' -- $token ) )
|
197
197
|
|
198
198
|
fi
|
199
199
|
}
|
@@ -221,9 +221,9 @@ _doing_plugins() {
|
|
221
221
|
_doing_recent() {
|
222
222
|
|
223
223
|
if [[ "$token" == --* ]]; then
|
224
|
-
COMPREPLY=( $( compgen -W '--interactive --section --times --tag_sort --totals' -- $token ) )
|
224
|
+
COMPREPLY=( $( compgen -W '--duration --interactive --section --times --tag_sort --totals' -- $token ) )
|
225
225
|
elif [[ "$token" == -* ]]; then
|
226
|
-
COMPREPLY=( $( compgen -W '-i -s -t --interactive --section --times --tag_sort --totals' -- $token ) )
|
226
|
+
COMPREPLY=( $( compgen -W '-i -s -t --duration --interactive --section --times --tag_sort --totals' -- $token ) )
|
227
227
|
|
228
228
|
fi
|
229
229
|
}
|
@@ -276,9 +276,9 @@ local words=$(doing sections)
|
|
276
276
|
IFS="$OLD_IFS"
|
277
277
|
|
278
278
|
if [[ "$token" == --* ]]; then
|
279
|
-
COMPREPLY=( $( compgen -W '--age --after --bool --before --count --case --from --interactive --not --output --only_timed --sort --search --times --tag --tag_order --tag_sort --totals --exact' -- $token ) )
|
279
|
+
COMPREPLY=( $( compgen -W '--age --after --bool --before --count --case --duration --from --interactive --not --output --only_timed --sort --search --times --tag --tag_order --tag_sort --totals --exact' -- $token ) )
|
280
280
|
elif [[ "$token" == -* ]]; then
|
281
|
-
COMPREPLY=( $( compgen -W '-a -b -c -i -o -s -t -x --age --after --bool --before --count --case --from --interactive --not --output --only_timed --sort --search --times --tag --tag_order --tag_sort --totals --exact' -- $token ) )
|
281
|
+
COMPREPLY=( $( compgen -W '-a -b -c -i -o -s -t -x --age --after --bool --before --count --case --duration --from --interactive --not --output --only_timed --sort --search --times --tag --tag_order --tag_sort --totals --exact' -- $token ) )
|
282
282
|
else
|
283
283
|
local nocasematchWasOff=0
|
284
284
|
shopt nocasematch >/dev/null || nocasematchWasOff=1
|
@@ -301,9 +301,9 @@ IFS="$OLD_IFS"
|
|
301
301
|
_doing_since() {
|
302
302
|
|
303
303
|
if [[ "$token" == --* ]]; then
|
304
|
-
COMPREPLY=( $( compgen -W '--output --section --times --tag_sort --totals' -- $token ) )
|
304
|
+
COMPREPLY=( $( compgen -W '--duration --output --section --times --tag_sort --totals' -- $token ) )
|
305
305
|
elif [[ "$token" == -* ]]; then
|
306
|
-
COMPREPLY=( $( compgen -W '-o -s -t --output --section --times --tag_sort --totals' -- $token ) )
|
306
|
+
COMPREPLY=( $( compgen -W '-o -s -t --duration --output --section --times --tag_sort --totals' -- $token ) )
|
307
307
|
|
308
308
|
fi
|
309
309
|
}
|
@@ -331,9 +331,9 @@ _doing_template() {
|
|
331
331
|
_doing_today() {
|
332
332
|
|
333
333
|
if [[ "$token" == --* ]]; then
|
334
|
-
COMPREPLY=( $( compgen -W '--after --before --from --output --section --times --tag_sort --totals' -- $token ) )
|
334
|
+
COMPREPLY=( $( compgen -W '--after --before --duration --from --output --section --times --tag_sort --totals' -- $token ) )
|
335
335
|
elif [[ "$token" == -* ]]; then
|
336
|
-
COMPREPLY=( $( compgen -W '-o -s -t --after --before --from --output --section --times --tag_sort --totals' -- $token ) )
|
336
|
+
COMPREPLY=( $( compgen -W '-o -s -t --after --before --duration --from --output --section --times --tag_sort --totals' -- $token ) )
|
337
337
|
|
338
338
|
fi
|
339
339
|
}
|
@@ -356,9 +356,9 @@ local words=$(doing views)
|
|
356
356
|
IFS="$OLD_IFS"
|
357
357
|
|
358
358
|
if [[ "$token" == --* ]]; then
|
359
|
-
COMPREPLY=( $( compgen -W '--after --bool --before --count --case --color --from --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --totals --exact' -- $token ) )
|
359
|
+
COMPREPLY=( $( compgen -W '--after --bool --before --count --case --color --duration --from --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --totals --exact' -- $token ) )
|
360
360
|
elif [[ "$token" == -* ]]; then
|
361
|
-
COMPREPLY=( $( compgen -W '-b -c -i -o -s -t -x --after --bool --before --count --case --color --from --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --totals --exact' -- $token ) )
|
361
|
+
COMPREPLY=( $( compgen -W '-b -c -i -o -s -t -x --after --bool --before --count --case --color --duration --from --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --totals --exact' -- $token ) )
|
362
362
|
else
|
363
363
|
local nocasematchWasOff=0
|
364
364
|
shopt nocasematch >/dev/null || nocasematchWasOff=1
|
@@ -401,9 +401,9 @@ _doing_wiki() {
|
|
401
401
|
_doing_yesterday() {
|
402
402
|
|
403
403
|
if [[ "$token" == --* ]]; then
|
404
|
-
COMPREPLY=( $( compgen -W '--after --before --from --output --section --times --tag_order --tag_sort --totals' -- $token ) )
|
404
|
+
COMPREPLY=( $( compgen -W '--after --before --duration --from --output --section --times --tag_order --tag_sort --totals' -- $token ) )
|
405
405
|
elif [[ "$token" == -* ]]; then
|
406
|
-
COMPREPLY=( $( compgen -W '-o -s -t --after --before --from --output --section --times --tag_order --tag_sort --totals' -- $token ) )
|
406
|
+
COMPREPLY=( $( compgen -W '-o -s -t --after --before --duration --from --output --section --times --tag_order --tag_sort --totals' -- $token ) )
|
407
407
|
|
408
408
|
fi
|
409
409
|
}
|
data/lib/doing/configuration.rb
CHANGED
@@ -32,28 +32,29 @@ module Doing
|
|
32
32
|
'never_finish' => [],
|
33
33
|
|
34
34
|
'timer_format' => 'text',
|
35
|
+
'interval_format' => 'text',
|
35
36
|
|
36
37
|
'templates' => {
|
37
38
|
'default' => {
|
38
39
|
'date_format' => '%Y-%m-%d %H:%M',
|
39
|
-
'template' => '%date | %title%note',
|
40
|
+
'template' => '%date | %title %interval%duration%note',
|
40
41
|
'wrap_width' => 0,
|
41
42
|
'order' => 'asc'
|
42
43
|
},
|
43
44
|
'today' => {
|
44
45
|
'date_format' => '%_I:%M%P',
|
45
|
-
'template' => '%date: %title %interval%note',
|
46
|
+
'template' => '%date: %title %interval%duration%note',
|
46
47
|
'wrap_width' => 0,
|
47
48
|
'order' => 'asc'
|
48
49
|
},
|
49
50
|
'last' => {
|
50
51
|
'date_format' => '%-I:%M%P on %a',
|
51
|
-
'template' => '%title (at %date)%odnote',
|
52
|
+
'template' => '%title (at %date) %interval%duration%odnote',
|
52
53
|
'wrap_width' => 88
|
53
54
|
},
|
54
55
|
'recent' => {
|
55
56
|
'date_format' => '%_I:%M%P',
|
56
|
-
'template' => '%shortdate: %title (%section)',
|
57
|
+
'template' => '%shortdate: %title (%section) %interval%duration%note',
|
57
58
|
'wrap_width' => 88,
|
58
59
|
'count' => 10,
|
59
60
|
'order' => 'asc'
|
@@ -153,7 +154,7 @@ module Doing
|
|
153
154
|
## matched, first match wins)
|
154
155
|
## @return [Array] ordered array of resolved keys
|
155
156
|
##
|
156
|
-
def resolve_key_path(keypath)
|
157
|
+
def resolve_key_path(keypath, create: false)
|
157
158
|
cfg = @settings
|
158
159
|
real_path = []
|
159
160
|
unless keypath =~ /^[.*]?$/
|
@@ -170,8 +171,18 @@ module Doing
|
|
170
171
|
end
|
171
172
|
|
172
173
|
if new_cfg.nil?
|
173
|
-
|
174
|
-
|
174
|
+
return nil unless create
|
175
|
+
|
176
|
+
resolved = real_path.count.positive? ? "Resolved #{real_path.join('->')}, but " : ''
|
177
|
+
Doing.logger.log_now(:warn, "#{resolved}#{path} is unknown")
|
178
|
+
new_path = [*real_path, path, *paths].join('->')
|
179
|
+
Doing.logger.log_now(:warn, "Continuing will create the path #{new_path}")
|
180
|
+
res = Prompt.yn('Key path not found, create it?', default_response: true)
|
181
|
+
raise InvalidArgument, 'Invalid key path' unless res
|
182
|
+
|
183
|
+
real_path.push(path).concat(paths)
|
184
|
+
Doing.logger.debug('Config:', "translated key path #{keypath} to #{real_path.join('.')}")
|
185
|
+
return real_path
|
175
186
|
end
|
176
187
|
cfg = new_cfg
|
177
188
|
end
|
@@ -194,7 +205,7 @@ module Doing
|
|
194
205
|
cfg = @settings
|
195
206
|
real_path = ['config']
|
196
207
|
unless keypath =~ /^[.*]?$/
|
197
|
-
real_path = resolve_key_path(keypath)
|
208
|
+
real_path = resolve_key_path(keypath, create: false)
|
198
209
|
return nil unless real_path&.count&.positive?
|
199
210
|
|
200
211
|
cfg = cfg.dig(*real_path)
|
data/lib/doing/item.rb
CHANGED
@@ -31,6 +31,13 @@ module Doing
|
|
31
31
|
# @date = new_date.is_a?(Time) ? new_date : Time.parse(new_date)
|
32
32
|
# end
|
33
33
|
|
34
|
+
## If the entry doesn't have a @done date, return the elapsed time
|
35
|
+
def duration
|
36
|
+
return nil if @title =~ /(?<=^| )@done\b/
|
37
|
+
|
38
|
+
return Time.now - @date
|
39
|
+
end
|
40
|
+
|
34
41
|
##
|
35
42
|
## Get the difference between the item's start date and
|
36
43
|
## the value of its @done tag (if present)
|
@@ -58,11 +58,35 @@ module Doing
|
|
58
58
|
format("%#{pad}s", item.date.strftime(opt[:format]))
|
59
59
|
end
|
60
60
|
|
61
|
-
interval = wwid.get_interval(item, record: true) if opt[:times]
|
61
|
+
interval = wwid.get_interval(item, record: true, formatted: false) if opt[:times]
|
62
|
+
if interval
|
63
|
+
case opt[:interval_format].to_sym
|
64
|
+
when :human
|
65
|
+
_d, h, m = wwid.format_time(interval, human: true)
|
66
|
+
interval = format('%<h> 4dh %<m>02dm', h: h, m: m)
|
67
|
+
else
|
68
|
+
d, h, m = wwid.format_time(interval)
|
69
|
+
interval = format('%<d>02d:%<h>02d:%<m>02d', d: d, h: h, m: m)
|
70
|
+
end
|
71
|
+
end
|
62
72
|
|
63
73
|
interval ||= ''
|
64
74
|
output.sub!(/%interval/, interval)
|
65
75
|
|
76
|
+
duration = item.duration if opt[:duration]
|
77
|
+
if duration
|
78
|
+
case opt[:interval_format].to_sym
|
79
|
+
when :human
|
80
|
+
_d, h, m = wwid.format_time(duration, human: true)
|
81
|
+
duration = format('%<h> 4dh %<m>02dm', h: h, m: m)
|
82
|
+
else
|
83
|
+
d, h, m = wwid.format_time(duration)
|
84
|
+
duration = format('%<d>02d:%<h>02d:%<m>02d', d: d, h: h, m: m)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
duration ||= ''
|
88
|
+
output.sub!(/%duration/, duration)
|
89
|
+
|
66
90
|
output.sub!(/%(\d+)?shortdate/) do
|
67
91
|
pad = Regexp.last_match(1) || 13
|
68
92
|
format("%#{pad}s", item.date.relative_date)
|
data/lib/doing/prompt.rb
CHANGED
@@ -110,10 +110,12 @@ module Doing
|
|
110
110
|
return nil unless $stdout.isatty
|
111
111
|
|
112
112
|
# fzf_args << '-1' # User is expecting a menu, and even if only one it seves as confirmation
|
113
|
-
fzf_args << %(--prompt
|
113
|
+
fzf_args << %(--prompt="#{prompt}")
|
114
|
+
fzf_args << "--height=#{options.count + 2}"
|
115
|
+
fzf_args << '--info=inline'
|
114
116
|
fzf_args << '--multi' if multiple
|
115
117
|
header = "esc: cancel,#{multiple ? ' tab: multi-select, ctrl-a: select all,' : ''} return: confirm"
|
116
|
-
fzf_args << %(--header
|
118
|
+
fzf_args << %(--header="#{header}")
|
117
119
|
options.sort! if sorted
|
118
120
|
res = `echo #{Shellwords.escape(options.join("\n"))}|#{fzf} #{fzf_args.join(' ')}`
|
119
121
|
return false if res.strip.size.zero?
|
data/lib/doing/version.rb
CHANGED
data/lib/doing/wwid.rb
CHANGED
@@ -1429,20 +1429,23 @@ module Doing
|
|
1429
1429
|
##
|
1430
1430
|
def list_section(opt = {})
|
1431
1431
|
opt[:config_template] ||= 'default'
|
1432
|
-
cfg = @config.dig('templates',
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1432
|
+
cfg = @config.dig('templates',
|
1433
|
+
opt[:config_template]).deep_merge({
|
1434
|
+
'wrap_width' => @config['wrap_width'] || 0,
|
1435
|
+
'date_format' => @config['default_date_format'],
|
1436
|
+
'order' => @config['order'] || 'asc',
|
1437
|
+
'tags_color' => @config['tags_color'],
|
1438
|
+
'duration' => @config['duration'],
|
1439
|
+
'interval_format' => @config['interval_format']
|
1440
|
+
})
|
1441
|
+
opt[:duration] ||= cfg['duration'] || false
|
1442
|
+
opt[:interval_format] ||= cfg['interval_format'] || 'text'
|
1438
1443
|
opt[:count] ||= 0
|
1439
1444
|
opt[:age] ||= 'newest'
|
1440
1445
|
opt[:format] ||= cfg['date_format']
|
1441
1446
|
opt[:order] ||= cfg['order'] || 'asc'
|
1442
1447
|
opt[:tag_order] ||= 'asc'
|
1443
|
-
if opt[:tags_color].nil?
|
1444
|
-
opt[:tags_color] = cfg['tags_color'] || false
|
1445
|
-
end
|
1448
|
+
opt[:tags_color] = cfg['tags_color'] || false if opt[:tags_color].nil?
|
1446
1449
|
opt[:template] ||= cfg['template']
|
1447
1450
|
|
1448
1451
|
# opt[:highlight] ||= true
|
@@ -1452,17 +1455,17 @@ module Doing
|
|
1452
1455
|
opt[:section] = choose_section
|
1453
1456
|
title = opt[:section]
|
1454
1457
|
elsif opt[:section].instance_of?(String)
|
1455
|
-
if opt[:section] =~ /^all$/i
|
1456
|
-
|
1458
|
+
title = if opt[:section] =~ /^all$/i
|
1459
|
+
if opt[:page_title]
|
1457
1460
|
opt[:page_title]
|
1458
1461
|
elsif opt[:tag_filter] && opt[:tag_filter]['bool'].normalize_bool != :not
|
1459
1462
|
opt[:tag_filter]['tags'].map { |tag| "@#{tag}" }.join(' + ')
|
1460
1463
|
else
|
1461
1464
|
'doing'
|
1462
1465
|
end
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
+
else
|
1467
|
+
guess_section(opt[:section])
|
1468
|
+
end
|
1466
1469
|
end
|
1467
1470
|
|
1468
1471
|
items = filter_items(Items.new, opt: opt).reverse
|
@@ -1531,15 +1534,22 @@ module Doing
|
|
1531
1534
|
'wrap_width' => @config['wrap_width'] || 0,
|
1532
1535
|
'date_format' => @config['default_date_format'],
|
1533
1536
|
'order' => @config['order'] || 'asc',
|
1534
|
-
'tags_color' => @config['tags_color']
|
1537
|
+
'tags_color' => @config['tags_color'],
|
1538
|
+
'duration' => @config['duration'],
|
1539
|
+
'interval_format' => @config['interval_format']
|
1535
1540
|
})
|
1536
1541
|
|
1542
|
+
opt[:duration] ||= cfg['duration'] || false
|
1543
|
+
opt[:interval_format] ||= cfg['interval_format'] || 'text'
|
1544
|
+
|
1537
1545
|
options = {
|
1538
1546
|
after: opt[:after],
|
1539
1547
|
before: opt[:before],
|
1540
1548
|
count: 0,
|
1549
|
+
duration: opt[:duration],
|
1541
1550
|
from: opt[:from],
|
1542
1551
|
format: cfg['date_format'],
|
1552
|
+
interval_format: opt[:interval_format],
|
1543
1553
|
order: cfg['order'] || 'asc',
|
1544
1554
|
output: output,
|
1545
1555
|
section: opt[:section],
|
@@ -1571,8 +1581,18 @@ module Doing
|
|
1571
1581
|
# :date_filter expects an array with start and end date
|
1572
1582
|
dates = [dates, dates] if dates.instance_of?(String)
|
1573
1583
|
|
1574
|
-
list_section({
|
1575
|
-
|
1584
|
+
list_section({
|
1585
|
+
section: section,
|
1586
|
+
count: 0,
|
1587
|
+
order: 'asc',
|
1588
|
+
date_filter: dates,
|
1589
|
+
times: times,
|
1590
|
+
output: output,
|
1591
|
+
totals: opt[:totals],
|
1592
|
+
duration: opt[:duration],
|
1593
|
+
sort_tags: opt[:sort_tags],
|
1594
|
+
config_template: 'default'
|
1595
|
+
})
|
1576
1596
|
end
|
1577
1597
|
|
1578
1598
|
##
|
@@ -1595,6 +1615,7 @@ module Doing
|
|
1595
1615
|
after: opt[:after],
|
1596
1616
|
before: opt[:before],
|
1597
1617
|
count: 0,
|
1618
|
+
duration: opt[:duration],
|
1598
1619
|
from: opt[:from],
|
1599
1620
|
order: opt[:order],
|
1600
1621
|
output: output,
|
@@ -1626,8 +1647,13 @@ module Doing
|
|
1626
1647
|
'wrap_width' => @config['wrap_width'] || 0,
|
1627
1648
|
'date_format' => @config['default_date_format'],
|
1628
1649
|
'order' => @config['order'] || 'asc',
|
1629
|
-
'tags_color' => @config['tags_color']
|
1650
|
+
'tags_color' => @config['tags_color'],
|
1651
|
+
'duration' => @config['duration'],
|
1652
|
+
'interval_format' => @config['interval_format']
|
1630
1653
|
})
|
1654
|
+
opt[:duration] ||= cfg['duration'] || false
|
1655
|
+
opt[:interval_format] ||= cfg['interval_format'] || 'text'
|
1656
|
+
|
1631
1657
|
section ||= @config['current_section']
|
1632
1658
|
section = guess_section(section)
|
1633
1659
|
|
@@ -1649,8 +1675,12 @@ module Doing
|
|
1649
1675
|
'wrap_width' => @config['wrap_width'] || 0,
|
1650
1676
|
'date_format' => @config['default_date_format'],
|
1651
1677
|
'order' => @config['order'] || 'asc',
|
1652
|
-
'tags_color' => @config['tags_color']
|
1678
|
+
'tags_color' => @config['tags_color'],
|
1679
|
+
'duration' => @config['duration'],
|
1680
|
+
'interval_format' => @config['interval_format']
|
1653
1681
|
})
|
1682
|
+
options[:duration] ||= cfg['duration'] || false
|
1683
|
+
options[:interval_format] ||= cfg['interval_format'] || 'text'
|
1654
1684
|
|
1655
1685
|
opts = {
|
1656
1686
|
section: section,
|
@@ -1658,7 +1688,12 @@ module Doing
|
|
1658
1688
|
count: 1,
|
1659
1689
|
format: cfg['date_format'],
|
1660
1690
|
template: cfg['template'],
|
1661
|
-
times: times
|
1691
|
+
times: times,
|
1692
|
+
duration: options[:duration],
|
1693
|
+
interval_format: options[:interval_format],
|
1694
|
+
case: options[:case],
|
1695
|
+
not: options[:negate],
|
1696
|
+
config_template: 'last'
|
1662
1697
|
}
|
1663
1698
|
|
1664
1699
|
if options[:tag]
|
@@ -1669,9 +1704,7 @@ module Doing
|
|
1669
1704
|
end
|
1670
1705
|
|
1671
1706
|
opts[:search] = options[:search] if options[:search]
|
1672
|
-
|
1673
|
-
opts[:not] = options[:negate]
|
1674
|
-
opts[:config_template] = 'last'
|
1707
|
+
|
1675
1708
|
list_section(opts)
|
1676
1709
|
end
|
1677
1710
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: safe_yaml
|