doing 2.1.16 → 2.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardoc/checksums +13 -12
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/CHANGELOG.md +136 -53
- data/Gemfile.lock +11 -11
- data/README.md +1 -1
- data/Rakefile +10 -4
- data/bin/doing +146 -169
- data/docs/doc/Array.html +3 -3
- data/docs/doc/BooleanTermParser/Clause.html +3 -3
- data/docs/doc/BooleanTermParser/Operator.html +3 -3
- data/docs/doc/BooleanTermParser/Query.html +3 -3
- data/docs/doc/BooleanTermParser/QueryParser.html +3 -3
- data/docs/doc/BooleanTermParser/QueryTransformer.html +3 -3
- data/docs/doc/BooleanTermParser.html +3 -3
- data/docs/doc/Doing/Color.html +8 -4
- data/docs/doc/Doing/Completion.html +3 -3
- data/docs/doc/Doing/Configuration.html +7 -5
- data/docs/doc/Doing/Errors/DoingNoTraceError.html +3 -3
- data/docs/doc/Doing/Errors/DoingRuntimeError.html +3 -3
- data/docs/doc/Doing/Errors/DoingStandardError.html +3 -3
- data/docs/doc/Doing/Errors/EmptyInput.html +3 -3
- data/docs/doc/Doing/Errors/NoResults.html +3 -3
- data/docs/doc/Doing/Errors/PluginException.html +3 -3
- data/docs/doc/Doing/Errors/UserCancelled.html +3 -3
- data/docs/doc/Doing/Errors/WrongCommand.html +3 -3
- data/docs/doc/Doing/Errors.html +3 -3
- data/docs/doc/Doing/Hooks.html +3 -3
- data/docs/doc/Doing/Item.html +121 -3
- data/docs/doc/Doing/Items.html +3 -3
- data/docs/doc/Doing/LogAdapter.html +3 -3
- data/docs/doc/Doing/Note.html +3 -3
- data/docs/doc/Doing/Pager.html +3 -3
- data/docs/doc/Doing/Plugins.html +3 -3
- data/docs/doc/Doing/Prompt.html +3 -3
- data/docs/doc/Doing/Section.html +3 -3
- data/docs/doc/Doing/TemplateString.html +4 -4
- data/docs/doc/Doing/Util/Backup.html +3 -3
- data/docs/doc/Doing/Util.html +3 -3
- data/docs/doc/Doing/WWID.html +66 -8
- data/docs/doc/Doing.html +4 -4
- data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +3 -3
- data/docs/doc/GLI/Commands.html +3 -3
- data/docs/doc/GLI.html +3 -3
- data/docs/doc/Hash.html +3 -3
- data/docs/doc/Numeric.html +3 -3
- data/docs/doc/PhraseParser/Operator.html +3 -3
- data/docs/doc/PhraseParser/PhraseClause.html +3 -3
- data/docs/doc/PhraseParser/Query.html +3 -3
- data/docs/doc/PhraseParser/QueryParser.html +3 -3
- data/docs/doc/PhraseParser/QueryTransformer.html +3 -3
- data/docs/doc/PhraseParser/TermClause.html +3 -3
- data/docs/doc/PhraseParser.html +3 -3
- data/docs/doc/Status.html +3 -3
- data/docs/doc/String.html +230 -17
- data/docs/doc/Symbol.html +3 -3
- data/docs/doc/Time.html +3 -3
- data/docs/doc/_index.html +4 -4
- data/docs/doc/file.README.html +4 -4
- data/docs/doc/frames.html +1 -1
- data/docs/doc/index.html +4 -4
- data/docs/doc/method_list.html +311 -239
- data/docs/doc/top-level-namespace.html +94 -3
- data/doing.gemspec +1 -1
- data/doing.rdoc +35 -6
- data/lib/completion/_doing.zsh +10 -10
- data/lib/completion/doing.bash +16 -16
- data/lib/completion/doing.fish +97 -15
- data/lib/doing/colors.rb +4 -0
- data/lib/doing/completion/fish_completion.rb +80 -11
- data/lib/doing/configuration.rb +3 -1
- data/lib/doing/hash.rb +1 -1
- data/lib/doing/item.rb +51 -0
- data/lib/doing/items.rb +3 -1
- data/lib/doing/log_adapter.rb +2 -2
- data/lib/doing/pager.rb +1 -1
- data/lib/doing/plugins/export/dayone_export.rb +1 -1
- data/lib/doing/plugins/export/markdown_export.rb +1 -1
- data/lib/doing/plugins/export/template_export.rb +2 -0
- data/lib/doing/prompt.rb +16 -5
- data/lib/doing/string.rb +54 -0
- data/lib/doing/string_chronify.rb +55 -17
- data/lib/doing/types.rb +19 -0
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +80 -52
- data/lib/examples/commands/later.rb +32 -0
- data/lib/helpers/threaded_tests.rb +250 -0
- metadata +9 -6
data/lib/completion/doing.fish
CHANGED
@@ -23,28 +23,97 @@ function __fish_doing_using_command
|
|
23
23
|
and return 0
|
24
24
|
end
|
25
25
|
|
26
|
+
function __fish_doing_cache_timer_expired
|
27
|
+
set -l timer __fish_doing_cache_timer_$argv[1]
|
28
|
+
if not set -q $timer
|
29
|
+
set -g $timer (date '+%s')
|
30
|
+
end
|
31
|
+
|
32
|
+
if test (math (date '+%s') - $$timer) -gt $argv[2]
|
33
|
+
set -g $timer (date '+%s')
|
34
|
+
return 1
|
35
|
+
end
|
36
|
+
|
37
|
+
return 0
|
38
|
+
end
|
39
|
+
|
40
|
+
function __fish_doing_subcommands
|
41
|
+
if not set -q __fish_doing_subcommands_cache
|
42
|
+
or __fish_doing_cache_timer_expired subcommands 86400
|
43
|
+
set -g -a __fish_doing_subcommands_cache (doing help -c)
|
44
|
+
end
|
45
|
+
printf '%s
|
46
|
+
' $__fish_doing_subcommands_cache
|
47
|
+
end
|
48
|
+
|
26
49
|
function __fish_doing_complete_sections
|
27
|
-
|
50
|
+
if not set -q __fish_doing_sections_cache
|
51
|
+
or __fish_doing_cache_timer_expired sections 3600
|
52
|
+
set -g -a __fish_doing_sections_cache (doing sections -c)
|
53
|
+
end
|
54
|
+
printf '%s
|
55
|
+
' $__fish_doing_sections_cache
|
56
|
+
__fish_doing_complete_show_tag
|
28
57
|
end
|
29
58
|
|
30
59
|
function __fish_doing_complete_views
|
31
|
-
|
60
|
+
if not set -q __fish_doing_views_cache
|
61
|
+
or __fish_doing_cache_timer_expired views 3600
|
62
|
+
set -g -a __fish_doing_views_cache (doing views -c)
|
63
|
+
end
|
64
|
+
printf '%s
|
65
|
+
' $__fish_doing_views_cache
|
32
66
|
end
|
33
67
|
|
34
|
-
function
|
35
|
-
|
68
|
+
function __fish_doing_export_plugin
|
69
|
+
if not set -q __fish_doing_export_plugin_cache
|
70
|
+
or __fish_doing_cache_timer_expired export_plugins 3600
|
71
|
+
set -g -a __fish_doing_export_plugin_cache (doing plugins --type export -c)
|
72
|
+
end
|
73
|
+
printf '%s
|
74
|
+
' $__fish_doing_export_plugin_cache
|
75
|
+
end
|
76
|
+
|
77
|
+
function __fish_doing_import_plugin
|
78
|
+
if not set -q __fish_doing_import_plugin_cache
|
79
|
+
or __fish_doing_cache_timer_expired import_plugins 3600
|
80
|
+
set -g -a __fish_doing_import_plugin_cache (doing plugins --type import -c)
|
81
|
+
end
|
82
|
+
printf '%s
|
83
|
+
' $__fish_doing_import_plugin_cache
|
84
|
+
end
|
85
|
+
|
86
|
+
function __fish_doing_complete_template
|
87
|
+
if not set -q __fish_doing_template_cache
|
88
|
+
or __fish_doing_cache_timer_expired template 3600
|
89
|
+
set -g -a __fish_doing_template_cache (doing template -c)
|
90
|
+
end
|
91
|
+
printf '%s
|
92
|
+
' $__fish_doing_template_cache
|
36
93
|
end
|
37
94
|
|
38
|
-
function
|
39
|
-
|
95
|
+
function __fish_doing_complete_tag
|
96
|
+
if not set -q __fish_doing_tag_cache
|
97
|
+
or __fish_doing_cache_timer_expired tags 60
|
98
|
+
set -g -a __fish_doing_tag_cache (doing tags)
|
99
|
+
end
|
100
|
+
printf '%s
|
101
|
+
' $__fish_doing_tag_cache
|
40
102
|
end
|
41
103
|
|
42
|
-
function
|
43
|
-
|
104
|
+
function __fish_doing_complete_show_tag
|
105
|
+
if not set -q __fish_doing_tag_cache
|
106
|
+
or __fish_doing_cache_timer_expired tags 60
|
107
|
+
set -g -a __fish_doing_tag_cache (doing tags)
|
108
|
+
end
|
109
|
+
printf '@%s
|
110
|
+
' $__fish_doing_tag_cache
|
44
111
|
end
|
45
112
|
|
46
|
-
function
|
47
|
-
doing
|
113
|
+
function __fish_doing_complete_args
|
114
|
+
for cmd in (doing commands_accepting -c $argv[1])
|
115
|
+
complete -x -c doing -l $argv[1] -n "__fish_doing_using_command $cmd" -a "(__fish_doing_complete_$argv[1])"
|
116
|
+
end
|
48
117
|
end
|
49
118
|
|
50
119
|
complete -c doing -f
|
@@ -57,6 +126,14 @@ complete -f -c doing -s t -l type -x -n '__fish_doing_using_command import' -a '
|
|
57
126
|
|
58
127
|
complete -xc doing -n '__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from (doing help -c)' -a "(doing help -c)"
|
59
128
|
|
129
|
+
function __fish_doing_complete_args
|
130
|
+
for cmd in (doing commands_accepting -c $argv[1])
|
131
|
+
complete -x -c doing -l $argv[1] -n "__fish_doing_using_command $cmd" -a "(__fish_doing_complete_$argv[1])"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
__fish_doing_complete_args tag
|
136
|
+
|
60
137
|
complete -xc doing -n '__fish_doing_needs_command' -a 'add_section' -d Add\ a\ new\ section\ to\ the\ \"doing\"\ file
|
61
138
|
complete -xc doing -n '__fish_doing_needs_command' -a 'again resume' -d Repeat\ last\ entry\ as\ new\ entry
|
62
139
|
complete -xc doing -n '__fish_doing_needs_command' -a 'archive move' -d Move\ entries\ between\ sections
|
@@ -100,6 +177,7 @@ complete -xc doing -n '__fish_doing_needs_command' -a 'views' -d List\ available
|
|
100
177
|
complete -xc doing -n '__fish_doing_needs_command' -a 'wiki' -d Output\ a\ tag\ wiki
|
101
178
|
complete -xc doing -n '__fish_doing_needs_command' -a 'yesterday' -d List\ entries\ from\ yesterday
|
102
179
|
complete -c doing -l ask -f -n '__fish_doing_using_command again resume' -d Prompt\ for\ note\ via\ multi-line\ input
|
180
|
+
complete -c doing -l started -f -r -n '__fish_doing_using_command again resume' -d Backdate\ start\ date\ by\ interval\ or\ set\ to\ time\ \[4pm\|20m\|2h\|\"yesterday\ noon\"\]
|
103
181
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command again resume' -d Boolean\ used\ to\ combine\ multiple\ tags
|
104
182
|
complete -c doing -l case -f -r -n '__fish_doing_using_command again resume' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
105
183
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command again resume' -d Edit\ duplicated\ entry\ with\ vim\ before\ adding
|
@@ -159,9 +237,9 @@ complete -c doing -l section -s s -f -r -n '__fish_doing_using_command done did'
|
|
159
237
|
complete -c doing -l for -f -r -n '__fish_doing_using_command done did' -d Set\ completion\ date\ to\ start\ date\ plus\ interval
|
160
238
|
complete -c doing -l unfinished -s u -f -n '__fish_doing_using_command done did' -d Finish\ last\ entry\ not\ already\ marked\ @done
|
161
239
|
complete -c doing -l archive -s a -f -n '__fish_doing_using_command finish' -d Archive\ entries
|
162
|
-
complete -c doing -l
|
240
|
+
complete -c doing -l finished -f -r -n '__fish_doing_using_command finish' -d Set\ finish\ date\ to\ specific\ date/time
|
163
241
|
complete -c doing -l auto -f -n '__fish_doing_using_command finish' -d Auto-generate\ finish\ dates\ from\ next\ entry\'s\ start\ time
|
164
|
-
complete -c doing -l
|
242
|
+
complete -c doing -l started -f -r -n '__fish_doing_using_command finish' -d Backdate\ completed\ date\ to\ date\ string\ \[4pm\|20m\|2h\|yesterday\ noon\]
|
165
243
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command finish' -d Boolean
|
166
244
|
complete -c doing -l case -f -r -n '__fish_doing_using_command finish' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
167
245
|
complete -c doing -l date -f -n '__fish_doing_using_command finish' -d Include\ date
|
@@ -183,6 +261,7 @@ complete -c doing -l delete -s d -f -n '__fish_doing_using_command grep search'
|
|
183
261
|
complete -c doing -l duration -f -n '__fish_doing_using_command grep search' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
|
184
262
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command grep search' -d Edit\ matching\ entries\ with\ vim
|
185
263
|
complete -c doing -l from -f -r -n '__fish_doing_using_command grep search' -d Date\ range\ to\ show
|
264
|
+
complete -c doing -l hilite -s h -f -n '__fish_doing_using_command grep search' -d Highlight\ search\ matches\ in\ output
|
186
265
|
complete -c doing -l interactive -s i -f -n '__fish_doing_using_command grep search' -d Display\ an\ interactive\ menu\ of\ results\ to\ perform\ further\ operations
|
187
266
|
complete -c doing -l not -f -n '__fish_doing_using_command grep search' -d Show\ items\ that\ \*don\'t\*\ match\ search\ string
|
188
267
|
complete -c doing -l output -s o -f -r -n '__fish_doing_using_command grep search' -d Output\ to\ export\ format
|
@@ -213,6 +292,7 @@ complete -c doing -l case -f -r -n '__fish_doing_using_command last' -d Case\ s
|
|
213
292
|
complete -c doing -l delete -s d -f -n '__fish_doing_using_command last' -d Delete\ the\ last\ entry
|
214
293
|
complete -c doing -l duration -f -n '__fish_doing_using_command last' -d Show\ elapsed\ time\ if\ entry\ is\ not\ tagged\ @done
|
215
294
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command last' -d Edit\ entry\ with\ vim
|
295
|
+
complete -c doing -l hilite -s h -f -n '__fish_doing_using_command last' -d Highlight\ search\ matches\ in\ output
|
216
296
|
complete -c doing -l not -f -n '__fish_doing_using_command last' -d Show\ items\ that\ \*don\'t\*\ match\ search\ string\ or\ tag\ filter
|
217
297
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command last' -d Specify\ a\ section
|
218
298
|
complete -c doing -l search -f -r -n '__fish_doing_using_command last' -d Search\ filter
|
@@ -220,7 +300,7 @@ complete -c doing -l tag -f -r -n '__fish_doing_using_command last' -d Tag\ fil
|
|
220
300
|
complete -c doing -l val -f -r -n '__fish_doing_using_command last' -d Perform\ a\ tag\ value\ query
|
221
301
|
complete -c doing -l exact -s x -f -n '__fish_doing_using_command last' -d Force\ exact\ search\ string\ matching
|
222
302
|
complete -c doing -l ask -f -n '__fish_doing_using_command later' -d Prompt\ for\ note\ via\ multi-line\ input
|
223
|
-
complete -c doing -l
|
303
|
+
complete -c doing -l started -f -r -n '__fish_doing_using_command later' -d Backdate\ start\ time\ to\ date\ string\ \[4pm\|20m\|2h\|yesterday\ noon\]
|
224
304
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command later' -d Edit\ entry\ with\ vim
|
225
305
|
complete -c doing -l note -s n -f -r -n '__fish_doing_using_command later' -d Note
|
226
306
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command mark flag' -d Boolean
|
@@ -239,7 +319,7 @@ complete -c doing -l val -f -r -n '__fish_doing_using_command mark flag' -d Per
|
|
239
319
|
complete -c doing -l exact -s x -f -n '__fish_doing_using_command mark flag' -d Force\ exact\ search\ string\ matching
|
240
320
|
complete -c doing -l archive -s a -f -n '__fish_doing_using_command meanwhile' -d Archive\ previous\ @meanwhile\ entry
|
241
321
|
complete -c doing -l ask -f -n '__fish_doing_using_command meanwhile' -d Prompt\ for\ note\ via\ multi-line\ input
|
242
|
-
complete -c doing -l
|
322
|
+
complete -c doing -l started -f -r -n '__fish_doing_using_command meanwhile' -d Backdate\ start\ date\ for\ new\ entry\ to\ date\ string\ \[4pm\|20m\|2h\|yesterday\ noon\]
|
243
323
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command meanwhile' -d Edit\ entry\ with\ vim
|
244
324
|
complete -c doing -l note -s n -f -r -n '__fish_doing_using_command meanwhile' -d Note
|
245
325
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command meanwhile' -d Section
|
@@ -331,6 +411,7 @@ complete -c doing -l count -s c -f -r -n '__fish_doing_using_command show' -d Ma
|
|
331
411
|
complete -c doing -l case -f -r -n '__fish_doing_using_command show' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
332
412
|
complete -c doing -l duration -f -n '__fish_doing_using_command show' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
|
333
413
|
complete -c doing -l from -f -r -n '__fish_doing_using_command show' -d Date\ range\ to\ show
|
414
|
+
complete -c doing -l hilite -s h -f -n '__fish_doing_using_command show' -d Highlight\ search\ matches\ in\ output
|
334
415
|
complete -c doing -l interactive -s i -f -n '__fish_doing_using_command show' -d Select\ from\ a\ menu\ of\ matching\ entries\ to\ perform\ additional\ operations
|
335
416
|
complete -c doing -l menu -s m -f -n '__fish_doing_using_command show' -d Select\ section\ or\ tag\ to\ display\ from\ a\ menu
|
336
417
|
complete -c doing -l not -f -n '__fish_doing_using_command show' -d Show\ items\ that\ \*don\'t\*\ match\ search/tag/date\ filters
|
@@ -408,6 +489,7 @@ complete -c doing -l case -f -r -n '__fish_doing_using_command view' -d Case\ s
|
|
408
489
|
complete -c doing -l color -f -n '__fish_doing_using_command view' -d Include\ colors\ in\ output
|
409
490
|
complete -c doing -l duration -f -n '__fish_doing_using_command view' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
|
410
491
|
complete -c doing -l from -f -r -n '__fish_doing_using_command view' -d Date\ range\ to\ show
|
492
|
+
complete -c doing -l hilite -s h -f -n '__fish_doing_using_command view' -d Highlight\ search\ matches\ in\ output
|
411
493
|
complete -c doing -l interactive -s i -f -n '__fish_doing_using_command view' -d Select\ from\ a\ menu\ of\ matching\ entries\ to\ perform\ additional\ operations
|
412
494
|
complete -c doing -l not -f -n '__fish_doing_using_command view' -d Show\ items\ that\ \*don\'t\*\ match\ search\ string
|
413
495
|
complete -c doing -l output -s o -f -r -n '__fish_doing_using_command view' -d Output\ to\ export\ format
|
@@ -440,7 +522,7 @@ complete -c doing -l times -s t -f -n '__fish_doing_using_command yesterday' -d
|
|
440
522
|
complete -c doing -l tag_order -f -r -n '__fish_doing_using_command yesterday' -d Tag\ sort\ direction
|
441
523
|
complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command yesterday' -d Sort\ tags\ by
|
442
524
|
complete -c doing -l totals -f -n '__fish_doing_using_command yesterday' -d Show\ time\ totals\ at\ the\ end\ of\ output
|
443
|
-
complete -f -c doing -s o -l output -x -n '__fish_doing_using_command grep search on select show since today view yesterday' -a '(
|
525
|
+
complete -f -c doing -s o -l output -x -n '__fish_doing_using_command grep search on select show since today view yesterday' -a '(__fish_doing_export_plugin)'
|
444
526
|
complete -f -c doing -s b -l bool -x -n '__fish_doing_using_command again resume archive move autotag cancel finish grep search last mark flag note reset begin rotate show tag tags view wiki' -a 'and or not pattern'
|
445
527
|
complete -f -c doing -l case -x -n '__fish_doing_using_command again resume archive move cancel finish grep search import last mark flag note reset begin rotate select show show tag tags tags view' -a 'case-sensitive ignore smart'
|
446
528
|
complete -f -c doing -l tag_sort -x -n '__fish_doing_using_command grep search on recent show since today view yesterday' -a 'name time'
|
data/lib/doing/colors.rb
CHANGED
@@ -24,6 +24,7 @@ module Doing
|
|
24
24
|
[:yellow, 33],
|
25
25
|
[:blue, 34],
|
26
26
|
[:magenta, 35],
|
27
|
+
[:purple, 35],
|
27
28
|
[:cyan, 36],
|
28
29
|
[:white, 37],
|
29
30
|
[:bgblack, 40],
|
@@ -32,6 +33,7 @@ module Doing
|
|
32
33
|
[:bgyellow, 43],
|
33
34
|
[:bgblue, 44],
|
34
35
|
[:bgmagenta, 45],
|
36
|
+
[:bgpurple, 45],
|
35
37
|
[:bgcyan, 46],
|
36
38
|
[:bgwhite, 47],
|
37
39
|
[:boldblack, 90], # High intensity, aixterm (works in OS X)
|
@@ -40,6 +42,7 @@ module Doing
|
|
40
42
|
[:boldyellow, 93],
|
41
43
|
[:boldblue, 94],
|
42
44
|
[:boldmagenta, 95],
|
45
|
+
[:boldpurple, 95],
|
43
46
|
[:boldcyan, 96],
|
44
47
|
[:boldwhite, 97],
|
45
48
|
[:boldbgblack, 100], # High intensity background, aixterm (works in OS X)
|
@@ -48,6 +51,7 @@ module Doing
|
|
48
51
|
[:boldbgyellow, 103],
|
49
52
|
[:boldbgblue, 104],
|
50
53
|
[:boldbgmagenta, 105],
|
54
|
+
[:boldbgpurple, 105],
|
51
55
|
[:boldbgcyan, 106],
|
52
56
|
[:boldbgwhite, 107],
|
53
57
|
[:softpurple, '0;35;40'],
|
@@ -31,28 +31,89 @@ module Doing
|
|
31
31
|
and return 0
|
32
32
|
end
|
33
33
|
|
34
|
+
function __fish_doing_cache_timer_expired
|
35
|
+
set -l timer __fish_doing_cache_timer_$argv[1]
|
36
|
+
if not set -q $timer
|
37
|
+
set -g $timer (date '+%s')
|
38
|
+
end
|
39
|
+
|
40
|
+
if test (math (date '+%s') - $$timer) -gt $argv[2]
|
41
|
+
set -g $timer (date '+%s')
|
42
|
+
return 1
|
43
|
+
end
|
44
|
+
|
45
|
+
return 0
|
46
|
+
end
|
47
|
+
|
48
|
+
function __fish_doing_subcommands
|
49
|
+
if not set -q __fish_doing_subcommands_cache
|
50
|
+
or __fish_doing_cache_timer_expired subcommands 86400
|
51
|
+
set -g -a __fish_doing_subcommands_cache (doing help -c)
|
52
|
+
end
|
53
|
+
printf '%s\n' $__fish_doing_subcommands_cache
|
54
|
+
end
|
55
|
+
|
34
56
|
function __fish_doing_complete_sections
|
35
|
-
|
57
|
+
if not set -q __fish_doing_sections_cache
|
58
|
+
or __fish_doing_cache_timer_expired sections 3600
|
59
|
+
set -g -a __fish_doing_sections_cache (doing sections -c)
|
60
|
+
end
|
61
|
+
printf '%s\n' $__fish_doing_sections_cache
|
62
|
+
__fish_doing_complete_show_tag
|
36
63
|
end
|
37
64
|
|
38
65
|
function __fish_doing_complete_views
|
39
|
-
|
66
|
+
if not set -q __fish_doing_views_cache
|
67
|
+
or __fish_doing_cache_timer_expired views 3600
|
68
|
+
set -g -a __fish_doing_views_cache (doing views -c)
|
69
|
+
end
|
70
|
+
printf '%s\n' $__fish_doing_views_cache
|
40
71
|
end
|
41
72
|
|
42
|
-
function
|
43
|
-
|
73
|
+
function __fish_doing_export_plugin
|
74
|
+
if not set -q __fish_doing_export_plugin_cache
|
75
|
+
or __fish_doing_cache_timer_expired export_plugins 3600
|
76
|
+
set -g -a __fish_doing_export_plugin_cache (doing plugins --type export -c)
|
77
|
+
end
|
78
|
+
printf '%s\n' $__fish_doing_export_plugin_cache
|
79
|
+
end
|
80
|
+
|
81
|
+
function __fish_doing_import_plugin
|
82
|
+
if not set -q __fish_doing_import_plugin_cache
|
83
|
+
or __fish_doing_cache_timer_expired import_plugins 3600
|
84
|
+
set -g -a __fish_doing_import_plugin_cache (doing plugins --type import -c)
|
85
|
+
end
|
86
|
+
printf '%s\n' $__fish_doing_import_plugin_cache
|
87
|
+
end
|
88
|
+
|
89
|
+
function __fish_doing_complete_template
|
90
|
+
if not set -q __fish_doing_template_cache
|
91
|
+
or __fish_doing_cache_timer_expired template 3600
|
92
|
+
set -g -a __fish_doing_template_cache (doing template -c)
|
93
|
+
end
|
94
|
+
printf '%s\n' $__fish_doing_template_cache
|
44
95
|
end
|
45
96
|
|
46
|
-
function
|
47
|
-
|
97
|
+
function __fish_doing_complete_tag
|
98
|
+
if not set -q __fish_doing_tag_cache
|
99
|
+
or __fish_doing_cache_timer_expired tags 60
|
100
|
+
set -g -a __fish_doing_tag_cache (doing tags)
|
101
|
+
end
|
102
|
+
printf '%s\n' $__fish_doing_tag_cache
|
48
103
|
end
|
49
104
|
|
50
|
-
function
|
51
|
-
|
105
|
+
function __fish_doing_complete_show_tag
|
106
|
+
if not set -q __fish_doing_tag_cache
|
107
|
+
or __fish_doing_cache_timer_expired tags 60
|
108
|
+
set -g -a __fish_doing_tag_cache (doing tags)
|
109
|
+
end
|
110
|
+
printf '@%s\n' $__fish_doing_tag_cache
|
52
111
|
end
|
53
112
|
|
54
|
-
function
|
55
|
-
doing
|
113
|
+
function __fish_doing_complete_args
|
114
|
+
for cmd in (doing commands_accepting -c $argv[1])
|
115
|
+
complete -x -c doing -l $argv[1] -n "__fish_doing_using_command $cmd" -a "(__fish_doing_complete_$argv[1])"
|
116
|
+
end
|
56
117
|
end
|
57
118
|
|
58
119
|
complete -c doing -f
|
@@ -64,6 +125,14 @@ module Doing
|
|
64
125
|
complete -f -c doing -s t -l type -x -n '__fish_doing_using_command import' -a '(__fish_doing_import_plugins)'
|
65
126
|
|
66
127
|
complete -xc doing -n '__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from (doing help -c)' -a "(doing help -c)"
|
128
|
+
|
129
|
+
function __fish_doing_complete_args
|
130
|
+
for cmd in (doing commands_accepting -c $argv[1])
|
131
|
+
complete -x -c doing -l $argv[1] -n "__fish_doing_using_command $cmd" -a "(__fish_doing_complete_$argv[1])"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
__fish_doing_complete_args tag
|
67
136
|
EOFUNCTIONS
|
68
137
|
end
|
69
138
|
|
@@ -161,7 +230,7 @@ module Doing
|
|
161
230
|
end
|
162
231
|
|
163
232
|
unless need_export.empty?
|
164
|
-
out << "complete -f -c doing -s o -l output -x -n '__fish_doing_using_command #{need_export.join(' ')}' -a '(
|
233
|
+
out << "complete -f -c doing -s o -l output -x -n '__fish_doing_using_command #{need_export.join(' ')}' -a '(__fish_doing_export_plugin)'"
|
165
234
|
end
|
166
235
|
|
167
236
|
unless need_bool.empty?
|
data/lib/doing/configuration.rb
CHANGED
@@ -30,6 +30,7 @@ module Doing
|
|
30
30
|
'command_path' => File.join(Util.user_home, '.config', 'doing', 'commands')
|
31
31
|
},
|
32
32
|
'doing_file' => '~/.local/share/doing/what_was_i_doing.md',
|
33
|
+
'doing_file_sort' => 'desc',
|
33
34
|
'backup_dir' => '~/.local/share/doing/doing_backup',
|
34
35
|
'history_size' => 15,
|
35
36
|
'current_section' => 'Currently',
|
@@ -99,7 +100,8 @@ module Doing
|
|
99
100
|
'search' => {
|
100
101
|
'matching' => 'pattern', # fuzzy, pattern, exact
|
101
102
|
'distance' => 3,
|
102
|
-
'case' => 'smart' # sensitive, ignore, smart
|
103
|
+
'case' => 'smart', # sensitive, ignore, smart
|
104
|
+
'highlight' => false
|
103
105
|
},
|
104
106
|
'include_notes' => true,
|
105
107
|
'interaction' => {
|
data/lib/doing/hash.rb
CHANGED
data/lib/doing/item.rb
CHANGED
@@ -9,6 +9,8 @@ module Doing
|
|
9
9
|
|
10
10
|
# attr_reader :id
|
11
11
|
|
12
|
+
include Color
|
13
|
+
|
12
14
|
##
|
13
15
|
## Initialize an item with date, title, section, and
|
14
16
|
## optional note
|
@@ -269,6 +271,34 @@ module Doing
|
|
269
271
|
(case_type == :smart && search !~ /[A-Z]/) || case_type == :ignore
|
270
272
|
end
|
271
273
|
|
274
|
+
def highlight_search(search, distance: nil, negate: false, case_type: nil)
|
275
|
+
prefs = Doing.config.settings['search'] || {}
|
276
|
+
matching = prefs.fetch('matching', 'pattern').normalize_matching
|
277
|
+
distance ||= prefs.fetch('distance', 3).to_i
|
278
|
+
case_type ||= prefs.fetch('case', 'smart').normalize_case
|
279
|
+
new_note = Note.new
|
280
|
+
|
281
|
+
if search.is_rx? || matching == :fuzzy
|
282
|
+
rx = search.to_rx(distance: distance, case_type: case_type)
|
283
|
+
new_title = @title.gsub(rx) { |m| yellow(m) }
|
284
|
+
new_note.add(@note.to_s.gsub(rx) { |m| yellow(m) })
|
285
|
+
else
|
286
|
+
query = to_phrase_query(search.strip)
|
287
|
+
|
288
|
+
if query[:must].nil? && query[:must_not].nil?
|
289
|
+
query[:must] = query[:should]
|
290
|
+
query[:should] = []
|
291
|
+
end
|
292
|
+
query[:must].concat(query[:should]).each do |s|
|
293
|
+
rx = Regexp.new(s.wildcard_to_rx, ignore_case(s, case_type))
|
294
|
+
new_title = @title.gsub(rx) { |m| yellow(m) }
|
295
|
+
new_note.add(@note.to_s.gsub(rx) { |m| yellow(m) })
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
Item.new(@date, new_title, @section, new_note)
|
300
|
+
end
|
301
|
+
|
272
302
|
##
|
273
303
|
## Test if item matches search string
|
274
304
|
##
|
@@ -372,6 +402,27 @@ module Doing
|
|
372
402
|
"\t- #{@date.strftime('%Y-%m-%d %H:%M')} | #{@title}#{@note.empty? ? '' : "\n#{@note}"}"
|
373
403
|
end
|
374
404
|
|
405
|
+
##
|
406
|
+
## outputs a colored string with relative date and highlighted tags
|
407
|
+
##
|
408
|
+
## @return Pretty representation of the object.
|
409
|
+
##
|
410
|
+
def to_pretty(elements: %i[date title section])
|
411
|
+
output = []
|
412
|
+
elements.each do |e|
|
413
|
+
case e
|
414
|
+
when :date
|
415
|
+
output << format('%13s |', @date.relative_date).cyan
|
416
|
+
when :section
|
417
|
+
output << "#{magenta}(#{white(@section)}#{magenta})"
|
418
|
+
when :title
|
419
|
+
output << @title.white.highlight_tags('cyan')
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
output.join(' ')
|
424
|
+
end
|
425
|
+
|
375
426
|
# @private
|
376
427
|
def inspect
|
377
428
|
# %(<Doing::Item @date=#{@date} @title="#{@title}" @section:"#{@section}" @note:#{@note.to_s}>)
|
data/lib/doing/items.rb
CHANGED
@@ -131,7 +131,9 @@ module Doing
|
|
131
131
|
out = []
|
132
132
|
@sections.each do |section|
|
133
133
|
out.push(section.original)
|
134
|
-
in_section(section.title).
|
134
|
+
items = in_section(section.title).sort_by { |i| i.date }
|
135
|
+
items.reverse! if Doing.config.settings['doing_file_sort'].normalize_order == 'desc'
|
136
|
+
items.each { |item| out.push(item.to_s)}
|
135
137
|
end
|
136
138
|
|
137
139
|
out.join("\n")
|
data/lib/doing/log_adapter.rb
CHANGED
@@ -398,9 +398,9 @@ module Doing
|
|
398
398
|
return topic.ljust(TOPIC_WIDTH) if topic && message.strip.empty?
|
399
399
|
|
400
400
|
topic = formatted_topic(topic, colon: block_given?)
|
401
|
-
message.truncmiddle!(@max_length - TOPIC_WIDTH - 5)
|
401
|
+
# message.truncmiddle!(@max_length - TOPIC_WIDTH - 5)
|
402
402
|
out = topic + message
|
403
|
-
out.truncate!(@max_length) if @max_length.positive?
|
403
|
+
# out.truncate!(@max_length) if @max_length.positive?
|
404
404
|
messages << out
|
405
405
|
out
|
406
406
|
end
|
data/lib/doing/pager.rb
CHANGED
@@ -75,7 +75,7 @@ module Doing
|
|
75
75
|
note = i.note.map { |line| line.strip.link_urls(format: :markdown) } if i.note
|
76
76
|
end
|
77
77
|
|
78
|
-
title = "#{title} @
|
78
|
+
title = "#{title} @section(#{i.section})" unless variables[:is_single]
|
79
79
|
|
80
80
|
tags.concat(i.tag_array).sort!.uniq!
|
81
81
|
flagged = day_flagged = true if i.tags?(wwid.config['marker_tag'])
|
@@ -48,7 +48,7 @@ module Doing
|
|
48
48
|
note = i.note.map { |line| line.strip.link_urls(format: :markdown) } if i.note
|
49
49
|
end
|
50
50
|
|
51
|
-
title = "#{title} @
|
51
|
+
title = "#{title} @section(#{i.section})" unless variables[:is_single]
|
52
52
|
|
53
53
|
interval = wwid.get_interval(i, record: true) if i.title =~ /@done\((\d{4}-\d\d-\d\d \d\d:\d\d.*?)\)/ && opt[:times]
|
54
54
|
interval ||= false
|
data/lib/doing/prompt.rb
CHANGED
@@ -17,6 +17,7 @@ module Doing
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def enter_text(prompt, default_response: '')
|
20
|
+
$stdin.reopen('/dev/tty')
|
20
21
|
return default_response if @default_answer
|
21
22
|
|
22
23
|
print "#{yellow(prompt).sub(/:?$/, ':')} #{reset}"
|
@@ -24,12 +25,13 @@ module Doing
|
|
24
25
|
end
|
25
26
|
|
26
27
|
def read_line(prompt: 'Enter text', completions: [], default_response: '')
|
28
|
+
$stdin.reopen('/dev/tty')
|
27
29
|
return default_response if @default_answer
|
28
30
|
|
29
31
|
unless completions.empty?
|
30
32
|
completions.sort!
|
31
33
|
comp = proc { |s| completions.grep(/^#{Regexp.escape(s)}/) }
|
32
|
-
Readline.completion_append_character =
|
34
|
+
Readline.completion_append_character = ' '
|
33
35
|
Readline.completion_proc = comp
|
34
36
|
end
|
35
37
|
|
@@ -41,20 +43,26 @@ module Doing
|
|
41
43
|
end
|
42
44
|
|
43
45
|
def read_lines(prompt: 'Enter text', completions: [])
|
46
|
+
$stdin.reopen('/dev/tty')
|
44
47
|
return default_response if @default_answer
|
45
48
|
|
46
49
|
completions.sort!
|
47
50
|
comp = proc { |s| completions.grep(/^#{Regexp.escape(s)}/) }
|
48
|
-
Readline.completion_append_character =
|
51
|
+
Readline.completion_append_character = ' '
|
49
52
|
Readline.completion_proc = comp
|
50
|
-
|
51
|
-
|
53
|
+
prompt_text = []
|
54
|
+
prompt_text << boldgreen(prompt.sub(/:?$/, ':'))
|
55
|
+
prompt_text << yellow(' Enter a blank line (')
|
56
|
+
prompt_text << boldwhite('return twice')
|
57
|
+
prompt_text << yellow(') to end editing')
|
58
|
+
puts prompt_text.join('')
|
52
59
|
|
53
60
|
res = []
|
54
61
|
|
55
62
|
begin
|
56
|
-
while line = Readline.readline('> ', true)
|
63
|
+
while (line = Readline.readline('> ', true))
|
57
64
|
break if line.strip.empty?
|
65
|
+
|
58
66
|
res << line.chomp
|
59
67
|
end
|
60
68
|
rescue Interrupt
|
@@ -65,6 +73,7 @@ module Doing
|
|
65
73
|
end
|
66
74
|
|
67
75
|
def request_lines(prompt: 'Enter text')
|
76
|
+
$stdin.reopen('/dev/tty')
|
68
77
|
ask_note = []
|
69
78
|
reader = TTY::Reader.new(interrupt: -> { raise Errors::UserCancelled }, track_history: false)
|
70
79
|
puts "#{boldgreen(prompt.sub(/:?$/, ':'))} #{yellow('Hit return for a new line, ')}#{boldwhite('enter a blank line (')}#{boldyellow('return twice')}#{boldwhite(') to end editing')}"
|
@@ -92,6 +101,8 @@ module Doing
|
|
92
101
|
return @force_answer
|
93
102
|
end
|
94
103
|
|
104
|
+
$stdin.reopen('/dev/tty')
|
105
|
+
|
95
106
|
default = if default_response.is_a?(String)
|
96
107
|
default_response =~ /y/i ? true : false
|
97
108
|
else
|
data/lib/doing/string.rb
CHANGED
@@ -101,6 +101,49 @@ module Doing
|
|
101
101
|
gsub(/(\s|m)(@[^ ("']+)/, "\\1#{tag_color}\\2#{last_color}")
|
102
102
|
end
|
103
103
|
|
104
|
+
def to_phrase_query(query)
|
105
|
+
parser = PhraseParser::QueryParser.new
|
106
|
+
transformer = PhraseParser::QueryTransformer.new
|
107
|
+
parse_tree = parser.parse(query)
|
108
|
+
transformer.apply(parse_tree).to_elasticsearch
|
109
|
+
end
|
110
|
+
|
111
|
+
def ignore_case(search, case_type)
|
112
|
+
(case_type == :smart && search !~ /[A-Z]/) || case_type == :ignore
|
113
|
+
end
|
114
|
+
|
115
|
+
def highlight_search!(search, distance: nil, negate: false, case_type: nil)
|
116
|
+
replace highlight_search(search, distance: distance, negate: negate, case_type: case_type)
|
117
|
+
end
|
118
|
+
|
119
|
+
def highlight_search(search, distance: nil, negate: false, case_type: nil)
|
120
|
+
out = dup
|
121
|
+
prefs = Doing.config.settings['search'] || {}
|
122
|
+
matching = prefs.fetch('matching', 'pattern').normalize_matching
|
123
|
+
distance ||= prefs.fetch('distance', 3).to_i
|
124
|
+
case_type ||= prefs.fetch('case', 'smart').normalize_case
|
125
|
+
|
126
|
+
if search.is_rx? || matching == :fuzzy
|
127
|
+
rx = search.to_rx(distance: distance, case_type: case_type)
|
128
|
+
out.gsub!(rx) { |m| m.bgyellow.black }
|
129
|
+
else
|
130
|
+
query = to_phrase_query(search.strip)
|
131
|
+
|
132
|
+
if query[:must].nil? && query[:must_not].nil?
|
133
|
+
query[:must] = query[:should]
|
134
|
+
query[:should] = []
|
135
|
+
end
|
136
|
+
qs = []
|
137
|
+
qs.concat(query[:must]) if query[:must]
|
138
|
+
qs.concat(query[:should]) if query[:should]
|
139
|
+
qs.each do |s|
|
140
|
+
rx = Regexp.new(s.wildcard_to_rx, ignore_case(s, case_type))
|
141
|
+
out.gsub!(rx) { |m| m.bgyellow.black }
|
142
|
+
end
|
143
|
+
end
|
144
|
+
out
|
145
|
+
end
|
146
|
+
|
104
147
|
##
|
105
148
|
## Test if line should be ignored
|
106
149
|
##
|
@@ -642,6 +685,15 @@ module Doing
|
|
642
685
|
end
|
643
686
|
end
|
644
687
|
|
688
|
+
def to_bool
|
689
|
+
case self
|
690
|
+
when /^[yt1]/i
|
691
|
+
true
|
692
|
+
else
|
693
|
+
false
|
694
|
+
end
|
695
|
+
end
|
696
|
+
|
645
697
|
##
|
646
698
|
## Convert a string value to an appropriate type. If
|
647
699
|
## kind is not specified, '[one, two]' becomes an Array,
|
@@ -661,6 +713,8 @@ module Doing
|
|
661
713
|
gsub(/^\[ *| *\]$/, '').split(/ *, */)
|
662
714
|
when /^i/i
|
663
715
|
to_i
|
716
|
+
when /^(fa|tr)/i
|
717
|
+
to_bool
|
664
718
|
when /^f/i
|
665
719
|
to_f
|
666
720
|
when /^sy/i
|