doing 2.1.13 → 2.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.irbrc +1 -0
- data/.yardoc/checksums +14 -12
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/CHANGELOG.md +76 -0
- data/Gemfile.lock +9 -2
- data/README.md +56 -19
- data/bin/doing +218 -68
- data/docs/doc/Array.html +117 -3
- data/docs/doc/BooleanTermParser/Clause.html +1 -1
- data/docs/doc/BooleanTermParser/Operator.html +1 -1
- data/docs/doc/BooleanTermParser/Query.html +1 -1
- data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
- data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
- data/docs/doc/BooleanTermParser.html +1 -1
- data/docs/doc/Doing/Color.html +6 -2
- data/docs/doc/Doing/Completion.html +1 -1
- data/docs/doc/Doing/Configuration.html +8 -4
- data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
- data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
- data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
- data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
- data/docs/doc/Doing/Errors/NoResults.html +1 -1
- data/docs/doc/Doing/Errors/PluginException.html +1 -1
- data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
- data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
- data/docs/doc/Doing/Errors.html +1 -1
- data/docs/doc/Doing/Hooks.html +1 -1
- data/docs/doc/Doing/Item.html +340 -14
- data/docs/doc/Doing/Items.html +2 -2
- data/docs/doc/Doing/LogAdapter.html +1 -1
- data/docs/doc/Doing/Note.html +2 -2
- data/docs/doc/Doing/Pager.html +1 -1
- data/docs/doc/Doing/Plugins.html +1 -1
- data/docs/doc/Doing/Prompt.html +103 -1
- data/docs/doc/Doing/Section.html +1 -1
- data/docs/doc/Doing/TemplateString.html +2 -2
- data/docs/doc/Doing/Util/Backup.html +1 -1
- data/docs/doc/Doing/Util.html +1 -1
- data/docs/doc/Doing/WWID.html +77 -71
- data/docs/doc/Doing.html +3 -3
- data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
- data/docs/doc/GLI/Commands.html +1 -1
- data/docs/doc/GLI.html +1 -1
- data/docs/doc/Hash.html +1 -1
- data/docs/doc/Numeric.html +279 -0
- data/docs/doc/PhraseParser/Operator.html +1 -1
- data/docs/doc/PhraseParser/PhraseClause.html +1 -1
- data/docs/doc/PhraseParser/Query.html +1 -1
- data/docs/doc/PhraseParser/QueryParser.html +1 -1
- data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
- data/docs/doc/PhraseParser/TermClause.html +1 -1
- data/docs/doc/PhraseParser.html +1 -1
- data/docs/doc/Status.html +1 -1
- data/docs/doc/String.html +997 -118
- data/docs/doc/Symbol.html +1 -1
- data/docs/doc/Time.html +1 -1
- data/docs/doc/_index.html +14 -9
- data/docs/doc/class_list.html +1 -1
- data/docs/doc/file.README.html +41 -15
- data/docs/doc/index.html +41 -15
- data/docs/doc/method_list.html +449 -305
- data/docs/doc/top-level-namespace.html +2 -2
- data/docs/index.md +56 -19
- data/doing.gemspec +2 -0
- data/doing.rdoc +76 -9
- data/example_plugin.rb +2 -4
- data/lib/completion/_doing.zsh +17 -17
- data/lib/completion/doing.bash +25 -25
- data/lib/completion/doing.fish +18 -6
- data/lib/doing/array_chronify.rb +57 -0
- data/lib/doing/colors.rb +4 -0
- data/lib/doing/configuration.rb +6 -2
- data/lib/doing/item.rb +108 -0
- data/lib/doing/log_adapter.rb +3 -3
- data/lib/doing/numeric_chronify.rb +40 -0
- data/lib/doing/plugins/export/dayone_export.rb +1 -1
- data/lib/doing/plugins/export/json_export.rb +2 -2
- data/lib/doing/plugins/export/template_export.rb +49 -90
- data/lib/doing/plugins/import/calendar_import.rb +13 -1
- data/lib/doing/plugins/import/doing_import.rb +12 -1
- data/lib/doing/plugins/import/timing_import.rb +13 -1
- data/lib/doing/prompt.rb +65 -1
- data/lib/doing/string.rb +137 -33
- data/lib/doing/string_chronify.rb +112 -14
- data/lib/doing/template_string.rb +1 -1
- data/lib/doing/time.rb +6 -6
- data/lib/doing/util_backup.rb +1 -1
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +117 -106
- data/lib/doing.rb +36 -31
- data/lib/examples/plugins/say_export.rb +1 -4
- metadata +46 -2
data/lib/completion/doing.bash
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
_doing_again() {
|
2
2
|
|
3
3
|
if [[ "$token" == --* ]]; then
|
4
|
-
COMPREPLY=( $( compgen -W '--bool --case --editor --interactive --in --note --not --section --search --tag --val --exact' -- $token ) )
|
4
|
+
COMPREPLY=( $( compgen -W '--ask --bool --case --editor --interactive --in --note --not --section --search --tag --val --exact' -- $token ) )
|
5
5
|
elif [[ "$token" == -* ]]; then
|
6
|
-
COMPREPLY=( $( compgen -W '-e -i -n -s -x --bool --case --editor --interactive --in --note --not --section --search --tag --val --exact' -- $token ) )
|
6
|
+
COMPREPLY=( $( compgen -W '-e -i -n -s -x --ask --bool --case --editor --interactive --in --note --not --section --search --tag --val --exact' -- $token ) )
|
7
7
|
|
8
8
|
fi
|
9
9
|
}
|
@@ -81,9 +81,9 @@ _doing_config() {
|
|
81
81
|
_doing_done() {
|
82
82
|
|
83
83
|
if [[ "$token" == --* ]]; then
|
84
|
-
COMPREPLY=( $( compgen -W '--archive --
|
84
|
+
COMPREPLY=( $( compgen -W '--archive --ask --finished --started --date --editor --from --note --remove --section --for --unfinished' -- $token ) )
|
85
85
|
elif [[ "$token" == -* ]]; then
|
86
|
-
COMPREPLY=( $( compgen -W '-a -e -n -r -s -
|
86
|
+
COMPREPLY=( $( compgen -W '-a -e -n -r -s -u --archive --ask --finished --started --date --editor --from --note --remove --section --for --unfinished' -- $token ) )
|
87
87
|
|
88
88
|
fi
|
89
89
|
}
|
@@ -91,9 +91,9 @@ _doing_done() {
|
|
91
91
|
_doing_finish() {
|
92
92
|
|
93
93
|
if [[ "$token" == --* ]]; then
|
94
|
-
COMPREPLY=( $( compgen -W '--archive --at --auto --back --bool --case --date --interactive --not --remove --section --search --
|
94
|
+
COMPREPLY=( $( compgen -W '--archive --at --auto --back --bool --case --date --interactive --not --remove --section --search --for --tag --unfinished --val --exact' -- $token ) )
|
95
95
|
elif [[ "$token" == -* ]]; then
|
96
|
-
COMPREPLY=( $( compgen -W '-a -b -i -r -s -
|
96
|
+
COMPREPLY=( $( compgen -W '-a -b -i -r -s -u -x --archive --at --auto --back --bool --case --date --interactive --not --remove --section --search --for --tag --unfinished --val --exact' -- $token ) )
|
97
97
|
|
98
98
|
fi
|
99
99
|
}
|
@@ -101,9 +101,9 @@ _doing_finish() {
|
|
101
101
|
_doing_grep() {
|
102
102
|
|
103
103
|
if [[ "$token" == --* ]]; then
|
104
|
-
COMPREPLY=( $( compgen -W '--after --before --bool --case --delete --duration --editor --from --interactive --not --output --only_timed --section --times --tag_sort --totals --val --exact' -- $token ) )
|
104
|
+
COMPREPLY=( $( compgen -W '--after --before --bool --case --delete --duration --editor --from --hilite --interactive --not --output --only_timed --section --times --tag_sort --totals --val --exact' -- $token ) )
|
105
105
|
elif [[ "$token" == -* ]]; then
|
106
|
-
COMPREPLY=( $( compgen -W '-d -e -i -o -s -t -x --after --before --bool --case --delete --duration --editor --from --interactive --not --output --only_timed --section --times --tag_sort --totals --val --exact' -- $token ) )
|
106
|
+
COMPREPLY=( $( compgen -W '-d -e -h -i -o -s -t -x --after --before --bool --case --delete --duration --editor --from --hilite --interactive --not --output --only_timed --section --times --tag_sort --totals --val --exact' -- $token ) )
|
107
107
|
|
108
108
|
fi
|
109
109
|
}
|
@@ -123,7 +123,7 @@ _doing_import() {
|
|
123
123
|
if [[ "$token" == --* ]]; then
|
124
124
|
COMPREPLY=( $( compgen -W '--after --autotag --before --case --from --not --only_timed --overlap --prefix --section --search --tag --type --exact' -- $token ) )
|
125
125
|
elif [[ "$token" == -* ]]; then
|
126
|
-
COMPREPLY=( $( compgen -W '-f -s -x --after --autotag --before --case --from --not --only_timed --overlap --prefix --section --search --tag --type --exact' -- $token ) )
|
126
|
+
COMPREPLY=( $( compgen -W '-f -s -t -x --after --autotag --before --case --from --not --only_timed --overlap --prefix --section --search --tag --type --exact' -- $token ) )
|
127
127
|
|
128
128
|
fi
|
129
129
|
}
|
@@ -131,9 +131,9 @@ _doing_import() {
|
|
131
131
|
_doing_last() {
|
132
132
|
|
133
133
|
if [[ "$token" == --* ]]; then
|
134
|
-
COMPREPLY=( $( compgen -W '--bool --case --delete --duration --editor --not --section --search --tag --val --exact' -- $token ) )
|
134
|
+
COMPREPLY=( $( compgen -W '--bool --case --delete --duration --editor --hilite --not --section --search --tag --val --exact' -- $token ) )
|
135
135
|
elif [[ "$token" == -* ]]; then
|
136
|
-
COMPREPLY=( $( compgen -W '-d -e -s -x --bool --case --delete --duration --editor --not --section --search --tag --val --exact' -- $token ) )
|
136
|
+
COMPREPLY=( $( compgen -W '-d -e -h -s -x --bool --case --delete --duration --editor --hilite --not --section --search --tag --val --exact' -- $token ) )
|
137
137
|
|
138
138
|
fi
|
139
139
|
}
|
@@ -141,9 +141,9 @@ _doing_last() {
|
|
141
141
|
_doing_later() {
|
142
142
|
|
143
143
|
if [[ "$token" == --* ]]; then
|
144
|
-
COMPREPLY=( $( compgen -W '--back --editor --note' -- $token ) )
|
144
|
+
COMPREPLY=( $( compgen -W '--ask --back --editor --note' -- $token ) )
|
145
145
|
elif [[ "$token" == -* ]]; then
|
146
|
-
COMPREPLY=( $( compgen -W '-b -e -n --back --editor --note' -- $token ) )
|
146
|
+
COMPREPLY=( $( compgen -W '-b -e -n --ask --back --editor --note' -- $token ) )
|
147
147
|
|
148
148
|
fi
|
149
149
|
}
|
@@ -161,9 +161,9 @@ _doing_mark() {
|
|
161
161
|
_doing_meanwhile() {
|
162
162
|
|
163
163
|
if [[ "$token" == --* ]]; then
|
164
|
-
COMPREPLY=( $( compgen -W '--archive --back --editor --note --section' -- $token ) )
|
164
|
+
COMPREPLY=( $( compgen -W '--archive --ask --back --editor --note --section' -- $token ) )
|
165
165
|
elif [[ "$token" == -* ]]; then
|
166
|
-
COMPREPLY=( $( compgen -W '-a -b -e -n -s --archive --back --editor --note --section' -- $token ) )
|
166
|
+
COMPREPLY=( $( compgen -W '-a -b -e -n -s --archive --ask --back --editor --note --section' -- $token ) )
|
167
167
|
|
168
168
|
fi
|
169
169
|
}
|
@@ -171,9 +171,9 @@ _doing_meanwhile() {
|
|
171
171
|
_doing_note() {
|
172
172
|
|
173
173
|
if [[ "$token" == --* ]]; then
|
174
|
-
COMPREPLY=( $( compgen -W '--bool --case --editor --interactive --not --remove --section --search --tag --val --exact' -- $token ) )
|
174
|
+
COMPREPLY=( $( compgen -W '--ask --bool --case --editor --interactive --not --remove --section --search --tag --val --exact' -- $token ) )
|
175
175
|
elif [[ "$token" == -* ]]; then
|
176
|
-
COMPREPLY=( $( compgen -W '-e -i -r -s -x --bool --case --editor --interactive --not --remove --section --search --tag --val --exact' -- $token ) )
|
176
|
+
COMPREPLY=( $( compgen -W '-e -i -r -s -x --ask --bool --case --editor --interactive --not --remove --section --search --tag --val --exact' -- $token ) )
|
177
177
|
|
178
178
|
fi
|
179
179
|
}
|
@@ -181,9 +181,9 @@ _doing_note() {
|
|
181
181
|
_doing_now() {
|
182
182
|
|
183
183
|
if [[ "$token" == --* ]]; then
|
184
|
-
COMPREPLY=( $( compgen -W '--started --editor --finish_last --note --section' -- $token ) )
|
184
|
+
COMPREPLY=( $( compgen -W '--ask --started --editor --finish_last --note --section' -- $token ) )
|
185
185
|
elif [[ "$token" == -* ]]; then
|
186
|
-
COMPREPLY=( $( compgen -W '-e -f -n -s --started --editor --finish_last --note --section' -- $token ) )
|
186
|
+
COMPREPLY=( $( compgen -W '-e -f -n -s --ask --started --editor --finish_last --note --section' -- $token ) )
|
187
187
|
|
188
188
|
fi
|
189
189
|
}
|
@@ -261,9 +261,9 @@ _doing_sections() {
|
|
261
261
|
_doing_select() {
|
262
262
|
|
263
263
|
if [[ "$token" == --* ]]; then
|
264
|
-
COMPREPLY=( $( compgen -W '--archive --after --resume --before --cancel --case --delete --editor --finish --flag --force --from --move --menu --not --output --
|
264
|
+
COMPREPLY=( $( compgen -W '--archive --after --resume --before --cancel --case --delete --editor --finish --flag --force --from --move --menu --not --output --query --remove --section --save_to --search --tag --val --exact' -- $token ) )
|
265
265
|
elif [[ "$token" == -* ]]; then
|
266
|
-
COMPREPLY=( $( compgen -W '-a -c -d -e -f -m -o -r -s -t -x --archive --after --resume --before --cancel --case --delete --editor --finish --flag --force --from --move --menu --not --output --
|
266
|
+
COMPREPLY=( $( compgen -W '-a -c -d -e -f -m -o -q -r -s -t -x --archive --after --resume --before --cancel --case --delete --editor --finish --flag --force --from --move --menu --not --output --query --remove --section --save_to --search --tag --val --exact' -- $token ) )
|
267
267
|
|
268
268
|
fi
|
269
269
|
}
|
@@ -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 --duration --from --interactive --menu --not --output --only_timed --sort --search --times --tag --tag_order --tag_sort --totals --val --exact' -- $token ) )
|
279
|
+
COMPREPLY=( $( compgen -W '--age --after --bool --before --count --case --duration --from --hilite --interactive --menu --not --output --only_timed --sort --search --times --tag --tag_order --tag_sort --totals --val --exact' -- $token ) )
|
280
280
|
elif [[ "$token" == -* ]]; then
|
281
|
-
COMPREPLY=( $( compgen -W '-a -b -c -i -m -o -s -t -x --age --after --bool --before --count --case --duration --from --interactive --menu --not --output --only_timed --sort --search --times --tag --tag_order --tag_sort --totals --val --exact' -- $token ) )
|
281
|
+
COMPREPLY=( $( compgen -W '-a -b -c -h -i -m -o -s -t -x --age --after --bool --before --count --case --duration --from --hilite --interactive --menu --not --output --only_timed --sort --search --times --tag --tag_order --tag_sort --totals --val --exact' -- $token ) )
|
282
282
|
else
|
283
283
|
local nocasematchWasOff=0
|
284
284
|
shopt nocasematch >/dev/null || nocasematchWasOff=1
|
@@ -376,9 +376,9 @@ local words=$(doing views)
|
|
376
376
|
IFS="$OLD_IFS"
|
377
377
|
|
378
378
|
if [[ "$token" == --* ]]; then
|
379
|
-
COMPREPLY=( $( compgen -W '--after --age --bool --before --count --case --color --duration --from --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --totals --val --exact' -- $token ) )
|
379
|
+
COMPREPLY=( $( compgen -W '--after --age --bool --before --count --case --color --duration --from --hilite --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --totals --val --exact' -- $token ) )
|
380
380
|
elif [[ "$token" == -* ]]; then
|
381
|
-
COMPREPLY=( $( compgen -W '-b -c -i -o -s -t -x --after --age --bool --before --count --case --color --duration --from --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --totals --val --exact' -- $token ) )
|
381
|
+
COMPREPLY=( $( compgen -W '-b -c -h -i -o -s -t -x --after --age --bool --before --count --case --color --duration --from --hilite --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --totals --val --exact' -- $token ) )
|
382
382
|
else
|
383
383
|
local nocasematchWasOff=0
|
384
384
|
shopt nocasematch >/dev/null || nocasematchWasOff=1
|
data/lib/completion/doing.fish
CHANGED
@@ -99,12 +99,13 @@ complete -xc doing -n '__fish_doing_needs_command' -a 'view' -d Display\ a\ user
|
|
99
99
|
complete -xc doing -n '__fish_doing_needs_command' -a 'views' -d List\ available\ custom\ views
|
100
100
|
complete -xc doing -n '__fish_doing_needs_command' -a 'wiki' -d Output\ a\ tag\ wiki
|
101
101
|
complete -xc doing -n '__fish_doing_needs_command' -a 'yesterday' -d List\ entries\ from\ yesterday
|
102
|
+
complete -c doing -l ask -f -n '__fish_doing_using_command again resume' -d Prompt\ for\ note\ via\ multi-line\ input
|
102
103
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command again resume' -d Boolean\ used\ to\ combine\ multiple\ tags
|
103
104
|
complete -c doing -l case -f -r -n '__fish_doing_using_command again resume' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
104
105
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command again resume' -d Edit\ duplicated\ entry\ with\ vim\ before\ adding
|
105
106
|
complete -c doing -l interactive -s i -f -n '__fish_doing_using_command again resume' -d Select\ item\ to\ resume\ from\ a\ menu\ of\ matching\ entries
|
106
107
|
complete -c doing -l in -f -r -n '__fish_doing_using_command again resume' -d Add\ new\ entry\ to\ section
|
107
|
-
complete -c doing -l note -s n -f -r -n '__fish_doing_using_command again resume' -d
|
108
|
+
complete -c doing -l note -s n -f -r -n '__fish_doing_using_command again resume' -d Add\ a\ note
|
108
109
|
complete -c doing -l not -f -n '__fish_doing_using_command again resume' -d Resume\ items\ that\ \*don\'t\*\ match\ search/tag\ filters
|
109
110
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command again resume' -d Get\ last\ entry\ from\ a\ specific\ section
|
110
111
|
complete -c doing -l search -f -r -n '__fish_doing_using_command again resume' -d Repeat\ last\ entry\ matching\ search
|
@@ -146,14 +147,16 @@ complete -c doing -l type -s t -f -r -n '__fish_doing_using_command completion'
|
|
146
147
|
complete -c doing -l dump -s d -f -n '__fish_doing_using_command config' -d DEPRECATED
|
147
148
|
complete -c doing -l update -s u -f -n '__fish_doing_using_command config' -d DEPRECATED
|
148
149
|
complete -c doing -l archive -s a -f -n '__fish_doing_using_command done did' -d Immediately\ archive\ the\ entry
|
149
|
-
complete -c doing -l
|
150
|
+
complete -c doing -l ask -f -n '__fish_doing_using_command done did' -d Prompt\ for\ note\ via\ multi-line\ input
|
151
|
+
complete -c doing -l finished -f -r -n '__fish_doing_using_command done did' -d Set\ finish\ date\ to\ specific\ date/time
|
150
152
|
complete -c doing -l started -f -r -n '__fish_doing_using_command done did' -d Backdate\ start\ date\ by\ interval\ or\ set\ to\ time\ \[4pm\|20m\|2h\|\"yesterday\ noon\"\]
|
151
153
|
complete -c doing -l date -f -n '__fish_doing_using_command done did' -d Include\ date
|
152
154
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command done did' -d Edit\ entry\ with\ vim
|
155
|
+
complete -c doing -l from -f -r -n '__fish_doing_using_command done did' -d Start\ and\ end\ times\ as\ a\ date/time\ range\ \`doing\ done\ --from\ \"1am\ to\ 8am\"\`
|
153
156
|
complete -c doing -l note -s n -f -r -n '__fish_doing_using_command done did' -d Include\ a\ note
|
154
157
|
complete -c doing -l remove -s r -f -n '__fish_doing_using_command done did' -d Remove\ @done\ tag
|
155
158
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command done did' -d Section
|
156
|
-
complete -c doing -l
|
159
|
+
complete -c doing -l for -f -r -n '__fish_doing_using_command done did' -d Set\ completion\ date\ to\ start\ date\ plus\ interval
|
157
160
|
complete -c doing -l unfinished -s u -f -n '__fish_doing_using_command done did' -d Finish\ last\ entry\ not\ already\ marked\ @done
|
158
161
|
complete -c doing -l archive -s a -f -n '__fish_doing_using_command finish' -d Archive\ entries
|
159
162
|
complete -c doing -l at -f -r -n '__fish_doing_using_command finish' -d Set\ finish\ date\ to\ specific\ date/time
|
@@ -167,7 +170,7 @@ complete -c doing -l not -f -n '__fish_doing_using_command finish' -d Finish\
|
|
167
170
|
complete -c doing -l remove -s r -f -n '__fish_doing_using_command finish' -d Remove\ done\ tag
|
168
171
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command finish' -d Section
|
169
172
|
complete -c doing -l search -f -r -n '__fish_doing_using_command finish' -d Finish\ the\ last\ X\ entries\ matching\ search\ filter
|
170
|
-
complete -c doing -l
|
173
|
+
complete -c doing -l for -f -r -n '__fish_doing_using_command finish' -d Set\ the\ completed\ date\ to\ the\ start\ date\ plus\ XX\[hmd\]
|
171
174
|
complete -c doing -l tag -f -r -n '__fish_doing_using_command finish' -d Finish\ the\ last\ X\ entries\ containing\ TAG
|
172
175
|
complete -c doing -l unfinished -s u -f -n '__fish_doing_using_command finish' -d Finish\ last\ entry
|
173
176
|
complete -c doing -l val -f -r -n '__fish_doing_using_command finish' -d Perform\ a\ tag\ value\ query
|
@@ -180,6 +183,7 @@ complete -c doing -l delete -s d -f -n '__fish_doing_using_command grep search'
|
|
180
183
|
complete -c doing -l duration -f -n '__fish_doing_using_command grep search' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
|
181
184
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command grep search' -d Edit\ matching\ entries\ with\ vim
|
182
185
|
complete -c doing -l from -f -r -n '__fish_doing_using_command grep search' -d Date\ range\ to\ show
|
186
|
+
complete -c doing -l hilite -s h -f -n '__fish_doing_using_command grep search' -d Highlight\ search\ matches\ in\ output
|
183
187
|
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
|
184
188
|
complete -c doing -l not -f -n '__fish_doing_using_command grep search' -d Show\ items\ that\ \*don\'t\*\ match\ search\ string
|
185
189
|
complete -c doing -l output -s o -f -r -n '__fish_doing_using_command grep search' -d Output\ to\ export\ format
|
@@ -202,7 +206,7 @@ complete -c doing -l overlap -f -n '__fish_doing_using_command import' -d Allo
|
|
202
206
|
complete -c doing -l prefix -f -r -n '__fish_doing_using_command import' -d Prefix\ entries\ with
|
203
207
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command import' -d Target\ section
|
204
208
|
complete -c doing -l search -f -r -n '__fish_doing_using_command import' -d Only\ import\ items\ matching\ search
|
205
|
-
complete -c doing -l tag
|
209
|
+
complete -c doing -l tag -s t -f -r -n '__fish_doing_using_command import' -d Tag\ all\ imported\ entries
|
206
210
|
complete -c doing -l type -f -r -n '__fish_doing_using_command import' -d Import\ type
|
207
211
|
complete -c doing -l exact -s x -f -n '__fish_doing_using_command import' -d Force\ exact\ search\ string\ matching
|
208
212
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command last' -d Tag\ boolean
|
@@ -210,12 +214,14 @@ complete -c doing -l case -f -r -n '__fish_doing_using_command last' -d Case\ s
|
|
210
214
|
complete -c doing -l delete -s d -f -n '__fish_doing_using_command last' -d Delete\ the\ last\ entry
|
211
215
|
complete -c doing -l duration -f -n '__fish_doing_using_command last' -d Show\ elapsed\ time\ if\ entry\ is\ not\ tagged\ @done
|
212
216
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command last' -d Edit\ entry\ with\ vim
|
217
|
+
complete -c doing -l hilite -s h -f -n '__fish_doing_using_command last' -d Highlight\ search\ matches\ in\ output
|
213
218
|
complete -c doing -l not -f -n '__fish_doing_using_command last' -d Show\ items\ that\ \*don\'t\*\ match\ search\ string\ or\ tag\ filter
|
214
219
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command last' -d Specify\ a\ section
|
215
220
|
complete -c doing -l search -f -r -n '__fish_doing_using_command last' -d Search\ filter
|
216
221
|
complete -c doing -l tag -f -r -n '__fish_doing_using_command last' -d Tag\ filter
|
217
222
|
complete -c doing -l val -f -r -n '__fish_doing_using_command last' -d Perform\ a\ tag\ value\ query
|
218
223
|
complete -c doing -l exact -s x -f -n '__fish_doing_using_command last' -d Force\ exact\ search\ string\ matching
|
224
|
+
complete -c doing -l ask -f -n '__fish_doing_using_command later' -d Prompt\ for\ note\ via\ multi-line\ input
|
219
225
|
complete -c doing -l back -s b -f -r -n '__fish_doing_using_command later' -d Backdate\ start\ time\ to\ date\ string\ \[4pm\|20m\|2h\|yesterday\ noon\]
|
220
226
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command later' -d Edit\ entry\ with\ vim
|
221
227
|
complete -c doing -l note -s n -f -r -n '__fish_doing_using_command later' -d Note
|
@@ -234,10 +240,12 @@ complete -c doing -l unfinished -s u -f -n '__fish_doing_using_command mark fla
|
|
234
240
|
complete -c doing -l val -f -r -n '__fish_doing_using_command mark flag' -d Perform\ a\ tag\ value\ query
|
235
241
|
complete -c doing -l exact -s x -f -n '__fish_doing_using_command mark flag' -d Force\ exact\ search\ string\ matching
|
236
242
|
complete -c doing -l archive -s a -f -n '__fish_doing_using_command meanwhile' -d Archive\ previous\ @meanwhile\ entry
|
243
|
+
complete -c doing -l ask -f -n '__fish_doing_using_command meanwhile' -d Prompt\ for\ note\ via\ multi-line\ input
|
237
244
|
complete -c doing -l back -s b -f -r -n '__fish_doing_using_command meanwhile' -d Backdate\ start\ date\ for\ new\ entry\ to\ date\ string\ \[4pm\|20m\|2h\|yesterday\ noon\]
|
238
245
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command meanwhile' -d Edit\ entry\ with\ vim
|
239
246
|
complete -c doing -l note -s n -f -r -n '__fish_doing_using_command meanwhile' -d Note
|
240
247
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command meanwhile' -d Section
|
248
|
+
complete -c doing -l ask -f -n '__fish_doing_using_command note' -d Prompt\ for\ note\ via\ multi-line\ input
|
241
249
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command note' -d Boolean
|
242
250
|
complete -c doing -l case -f -r -n '__fish_doing_using_command note' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
243
251
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command note' -d Edit\ entry\ with\ vim
|
@@ -249,6 +257,7 @@ complete -c doing -l search -f -r -n '__fish_doing_using_command note' -d Add/r
|
|
249
257
|
complete -c doing -l tag -f -r -n '__fish_doing_using_command note' -d Add/remove\ note\ from\ last\ entry\ matching\ tag
|
250
258
|
complete -c doing -l val -f -r -n '__fish_doing_using_command note' -d Perform\ a\ tag\ value\ query
|
251
259
|
complete -c doing -l exact -s x -f -n '__fish_doing_using_command note' -d Force\ exact\ search\ string\ matching
|
260
|
+
complete -c doing -l ask -f -n '__fish_doing_using_command now next' -d Prompt\ for\ note\ via\ multi-line\ input
|
252
261
|
complete -c doing -l started -f -r -n '__fish_doing_using_command now next' -d Backdate\ start\ time\ \[4pm\|20m\|2h\|\"yesterday\ noon\"\]
|
253
262
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command now next' -d Edit\ entry\ with\ vim
|
254
263
|
complete -c doing -l finish_last -s f -f -n '__fish_doing_using_command now next' -d Timed\ entry
|
@@ -308,10 +317,11 @@ complete -c doing -l move -s m -f -r -n '__fish_doing_using_command select' -d M
|
|
308
317
|
complete -c doing -l menu -f -n '__fish_doing_using_command select' -d Use\ --no-menu\ to\ skip\ the\ interactive\ menu
|
309
318
|
complete -c doing -l not -f -n '__fish_doing_using_command select' -d Select\ items\ that\ \*don\'t\*\ match\ search/tag\ filters
|
310
319
|
complete -c doing -l output -s o -f -r -n '__fish_doing_using_command select' -d Output\ entries\ to\ format
|
311
|
-
complete -c doing -l
|
320
|
+
complete -c doing -l query -s q -f -r -n '__fish_doing_using_command select' -d Initial\ search\ query\ for\ filtering
|
312
321
|
complete -c doing -l remove -s r -f -n '__fish_doing_using_command select' -d Reverse\ -c
|
313
322
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command select' -d Select\ from\ a\ specific\ section
|
314
323
|
complete -c doing -l save_to -f -r -n '__fish_doing_using_command select' -d Save\ selected\ entries\ to\ file\ using\ --output\ format
|
324
|
+
complete -c doing -l search -f -r -n '__fish_doing_using_command select' -d Select\ from\ entries\ matching\ search\ filter
|
315
325
|
complete -c doing -l tag -s t -f -r -n '__fish_doing_using_command select' -d Tag\ selected\ entries
|
316
326
|
complete -c doing -l val -f -r -n '__fish_doing_using_command select' -d Perform\ a\ tag\ value\ query
|
317
327
|
complete -c doing -l exact -s x -f -n '__fish_doing_using_command select' -d Force\ exact\ search\ string\ matching
|
@@ -323,6 +333,7 @@ complete -c doing -l count -s c -f -r -n '__fish_doing_using_command show' -d Ma
|
|
323
333
|
complete -c doing -l case -f -r -n '__fish_doing_using_command show' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
324
334
|
complete -c doing -l duration -f -n '__fish_doing_using_command show' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
|
325
335
|
complete -c doing -l from -f -r -n '__fish_doing_using_command show' -d Date\ range\ to\ show
|
336
|
+
complete -c doing -l hilite -s h -f -n '__fish_doing_using_command show' -d Highlight\ search\ matches\ in\ output
|
326
337
|
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
|
327
338
|
complete -c doing -l menu -s m -f -n '__fish_doing_using_command show' -d Select\ section\ or\ tag\ to\ display\ from\ a\ menu
|
328
339
|
complete -c doing -l not -f -n '__fish_doing_using_command show' -d Show\ items\ that\ \*don\'t\*\ match\ search/tag/date\ filters
|
@@ -400,6 +411,7 @@ complete -c doing -l case -f -r -n '__fish_doing_using_command view' -d Case\ s
|
|
400
411
|
complete -c doing -l color -f -n '__fish_doing_using_command view' -d Include\ colors\ in\ output
|
401
412
|
complete -c doing -l duration -f -n '__fish_doing_using_command view' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
|
402
413
|
complete -c doing -l from -f -r -n '__fish_doing_using_command view' -d Date\ range\ to\ show
|
414
|
+
complete -c doing -l hilite -s h -f -n '__fish_doing_using_command view' -d Highlight\ search\ matches\ in\ output
|
403
415
|
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
|
404
416
|
complete -c doing -l not -f -n '__fish_doing_using_command view' -d Show\ items\ that\ \*don\'t\*\ match\ search\ string
|
405
417
|
complete -c doing -l output -s o -f -r -n '__fish_doing_using_command view' -d Output\ to\ export\ format
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Doing
|
4
|
+
# Chronify array helpers
|
5
|
+
class ::Array
|
6
|
+
##
|
7
|
+
## Format [d, h, m] as string
|
8
|
+
##
|
9
|
+
## @param time [Array] Array of [days, hours,
|
10
|
+
## minutes]
|
11
|
+
## @param format [Symbol] The format, :dhm, :hm, :m, :clock, :natural
|
12
|
+
## @return [String] formatted string
|
13
|
+
##
|
14
|
+
def time_string(format: :dhm)
|
15
|
+
raise InvalidArgument, 'Invalid array, must be [d,h,m]' unless count == 3
|
16
|
+
|
17
|
+
d, h, m = self
|
18
|
+
case format
|
19
|
+
when :clock
|
20
|
+
format('%<d>02d:%<h>02d:%<m>02d', d: d, h: h, m: m)
|
21
|
+
when :dhm
|
22
|
+
output = []
|
23
|
+
output.push(format('%<d>dd', d: d)) if d.positive?
|
24
|
+
output.push(format('%<h>dh', h: h)) if h.positive?
|
25
|
+
output.push(format('%<m>dm', m: m)) if m.positive?
|
26
|
+
output.join(' ')
|
27
|
+
when :hm
|
28
|
+
h += d * 24 if d.positive?
|
29
|
+
format('%<h> 4dh %<m>02dm', h: h, m: m)
|
30
|
+
when :m
|
31
|
+
h += d * 24 if d.positive?
|
32
|
+
m += h * 60 if h.positive?
|
33
|
+
format('%<m> 4dm', m: m)
|
34
|
+
when :natural
|
35
|
+
human = []
|
36
|
+
human.push(format('%<d>d %<s>s', d: d, s: 'day'.to_p(d))) if d.positive?
|
37
|
+
human.push(format('%<h>d %<s>s', h: h, s: 'hour'.to_p(h))) if h.positive?
|
38
|
+
human.push(format('%<m>d %<s>s', m: m, s: 'minute'.to_p(m))) if m.positive?
|
39
|
+
human.join(', ')
|
40
|
+
when :speech
|
41
|
+
human = []
|
42
|
+
human.push(format('%<d>d %<s>s', d: d, s: 'day'.to_p(d))) if d.positive?
|
43
|
+
human.push(format('%<h>d %<s>s', h: h, s: 'hour'.to_p(h))) if h.positive?
|
44
|
+
human.push(format('%<m>d %<s>s', m: m, s: 'minute'.to_p(m))) if m.positive?
|
45
|
+
last = human.pop
|
46
|
+
case human.count
|
47
|
+
when 2
|
48
|
+
human.join(', ') + ", and #{last}"
|
49
|
+
when 1
|
50
|
+
"#{human[0]} and #{last}"
|
51
|
+
when 0
|
52
|
+
last
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
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'],
|
data/lib/doing/configuration.rb
CHANGED
@@ -99,9 +99,13 @@ module Doing
|
|
99
99
|
'search' => {
|
100
100
|
'matching' => 'pattern', # fuzzy, pattern, exact
|
101
101
|
'distance' => 3,
|
102
|
-
'case' => 'smart' # sensitive, ignore, smart
|
102
|
+
'case' => 'smart', # sensitive, ignore, smart
|
103
|
+
'highlight' => false
|
103
104
|
},
|
104
|
-
'include_notes' => true
|
105
|
+
'include_notes' => true,
|
106
|
+
'interaction' => {
|
107
|
+
'confirm_longer_than' => '5h'
|
108
|
+
}
|
105
109
|
}
|
106
110
|
|
107
111
|
def initialize(file = nil, options: {})
|
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
|
@@ -57,6 +59,25 @@ module Doing
|
|
57
59
|
@end_date ||= Time.parse(Regexp.last_match(1)) if @title =~ /@done\((\d{4}-\d\d-\d\d \d\d:\d\d.*?)\)/
|
58
60
|
end
|
59
61
|
|
62
|
+
def calculate_end_date(opt)
|
63
|
+
if opt[:took]
|
64
|
+
if @date + opt[:took] > Time.now
|
65
|
+
@date = Time.now - opt[:took]
|
66
|
+
Time.now
|
67
|
+
else
|
68
|
+
@date + opt[:took]
|
69
|
+
end
|
70
|
+
elsif opt[:back]
|
71
|
+
if opt[:back].is_a? Integer
|
72
|
+
@date + opt[:back]
|
73
|
+
else
|
74
|
+
@date + (opt[:back] - @date)
|
75
|
+
end
|
76
|
+
else
|
77
|
+
Time.now
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
60
81
|
# Generate a hash that represents the entry
|
61
82
|
#
|
62
83
|
# @return [String] entry hash
|
@@ -112,6 +133,19 @@ module Doing
|
|
112
133
|
(start_a >= start_b && start_a <= end_b) || (end_a >= start_b && end_a <= end_b) || (start_a < start_b && end_a > end_b)
|
113
134
|
end
|
114
135
|
|
136
|
+
##
|
137
|
+
## Updates the title of the Item by expanding natural
|
138
|
+
## language dates within configured date tags (tags
|
139
|
+
## whose value is expected to be a date)
|
140
|
+
##
|
141
|
+
## @param additional_tags An array of additional
|
142
|
+
## tag names to consider
|
143
|
+
## dates
|
144
|
+
##
|
145
|
+
def expand_date_tags(additional_tags = nil)
|
146
|
+
@title.expand_date_tags(additional_tags)
|
147
|
+
end
|
148
|
+
|
115
149
|
##
|
116
150
|
## Add (or remove) tags from the title of the item
|
117
151
|
##
|
@@ -162,6 +196,11 @@ module Doing
|
|
162
196
|
@title.scan(/(?<= |\A)@([^\s(]+)/).map { |tag| tag[0] }.sort.uniq
|
163
197
|
end
|
164
198
|
|
199
|
+
##
|
200
|
+
## convert tags on item to an array with @ symbols removed
|
201
|
+
##
|
202
|
+
## @return [Array] array of tags
|
203
|
+
##
|
165
204
|
def tag_array
|
166
205
|
tags.tags_to_array
|
167
206
|
end
|
@@ -220,10 +259,46 @@ module Doing
|
|
220
259
|
negate ? !matches : matches
|
221
260
|
end
|
222
261
|
|
262
|
+
##
|
263
|
+
## Determine if case should be ignored for searches
|
264
|
+
##
|
265
|
+
## @param search [String] The search string
|
266
|
+
## @param case_type [Symbol] The case type
|
267
|
+
##
|
268
|
+
## @return [Boolean] case should be ignored
|
269
|
+
##
|
223
270
|
def ignore_case(search, case_type)
|
224
271
|
(case_type == :smart && search !~ /[A-Z]/) || case_type == :ignore
|
225
272
|
end
|
226
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
|
+
|
227
302
|
##
|
228
303
|
## Test if item matches search string
|
229
304
|
##
|
@@ -279,10 +354,22 @@ module Doing
|
|
279
354
|
negate ? !matches : matches
|
280
355
|
end
|
281
356
|
|
357
|
+
##
|
358
|
+
## Test if item is included in never_finish config and
|
359
|
+
## thus should not receive a @done tag
|
360
|
+
##
|
361
|
+
## @return [Boolean] item should receive @done tag
|
362
|
+
##
|
282
363
|
def should_finish?
|
283
364
|
should?('never_finish')
|
284
365
|
end
|
285
366
|
|
367
|
+
##
|
368
|
+
## Test if item is included in never_time config and
|
369
|
+
## thus should not receive a date on the @done tag
|
370
|
+
##
|
371
|
+
## @return [Boolean] item should receive @done date
|
372
|
+
##
|
286
373
|
def should_time?
|
287
374
|
should?('never_time')
|
288
375
|
end
|
@@ -315,6 +402,27 @@ module Doing
|
|
315
402
|
"\t- #{@date.strftime('%Y-%m-%d %H:%M')} | #{@title}#{@note.empty? ? '' : "\n#{@note}"}"
|
316
403
|
end
|
317
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
|
+
|
318
426
|
# @private
|
319
427
|
def inspect
|
320
428
|
# %(<Doing::Item @date=#{@date} @title="#{@title}" @section:"#{@section}" @note:#{@note.to_s}>)
|
data/lib/doing/log_adapter.rb
CHANGED
@@ -52,7 +52,7 @@ module Doing
|
|
52
52
|
COUNT_KEYS.each { |key| @counters[key] = { tag: [], count: 0 } }
|
53
53
|
@results = []
|
54
54
|
@logdev = $stderr
|
55
|
-
@max_length =
|
55
|
+
@max_length = TTY::Screen.columns - 5 || 85
|
56
56
|
self.log_level = level
|
57
57
|
@prev_level = level
|
58
58
|
end
|
@@ -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
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Doing
|
4
|
+
##
|
5
|
+
## Number helpers
|
6
|
+
##
|
7
|
+
class ::Numeric
|
8
|
+
##
|
9
|
+
## Format human readable time from seconds
|
10
|
+
##
|
11
|
+
## @param seconds [Integer] Seconds
|
12
|
+
##
|
13
|
+
def format_time(human: false)
|
14
|
+
return [0, 0, 0] if nil?
|
15
|
+
|
16
|
+
seconds = dup.to_i
|
17
|
+
minutes = (seconds / 60).to_i
|
18
|
+
hours = (minutes / 60).to_i
|
19
|
+
if human
|
20
|
+
minutes = (minutes % 60).to_i
|
21
|
+
[0, hours, minutes]
|
22
|
+
else
|
23
|
+
days = (hours / 24).to_i
|
24
|
+
hours = (hours % 24).to_i
|
25
|
+
minutes = (minutes % 60).to_i
|
26
|
+
[days, hours, minutes]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
##
|
31
|
+
## Format seconds as natural language time string
|
32
|
+
##
|
33
|
+
## @param format [Symbol] The format to output
|
34
|
+
## (:dhm, :hm, :m, :clock, :natural)
|
35
|
+
##
|
36
|
+
def time_string(format: :dhm)
|
37
|
+
format_time(human: true).time_string(format: format)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -84,7 +84,7 @@ module Doing
|
|
84
84
|
interval ||= false
|
85
85
|
human_time = false
|
86
86
|
if interval
|
87
|
-
d, h, m = wwid.
|
87
|
+
d, h, m = wwid.get_interval(i, formatted: false).format_time
|
88
88
|
human_times = []
|
89
89
|
human_times << format('%<d>d day%<p>s', d: d, p: d == 1 ? '' : 's') if d > 0
|
90
90
|
human_times << format('%<h>d hour%<p>s', h: h, p: h == 1 ? '' : 's') if h > 0
|
@@ -56,7 +56,7 @@ module Doing
|
|
56
56
|
end_date: end_date,
|
57
57
|
title: title.strip, #+ " #{note}"
|
58
58
|
note: note.instance_of?(Array) ? note.to_s : note,
|
59
|
-
time:
|
59
|
+
time: interval.time_string(format: :clock),
|
60
60
|
tags: tags
|
61
61
|
}
|
62
62
|
|
@@ -68,7 +68,7 @@ module Doing
|
|
68
68
|
new_item = {
|
69
69
|
'id' => index + 1,
|
70
70
|
'content' => title.strip, #+ " #{note}"
|
71
|
-
'title' => title.strip + " (#{
|
71
|
+
'title' => title.strip + " (#{interval.time_string(format: :clock)})",
|
72
72
|
'start' => i.date.strftime('%F %T'),
|
73
73
|
'type' => 'box',
|
74
74
|
'style' => 'color:#4c566b;background-color:#d8dee9;'
|