doing 2.1.30 → 2.1.34
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/CHANGELOG.md +4972 -0
- data/Dockerfile-2.6 +3 -1
- data/Dockerfile-2.7 +4 -2
- data/Dockerfile-3.0 +3 -1
- data/Gemfile.lock +1 -67
- data/README.md +1 -1
- data/bash_profile +13 -0
- data/bin/commands/again.rb +1 -1
- data/bin/commands/archive.rb +3 -3
- data/bin/commands/cancel.rb +1 -1
- data/bin/commands/commands.rb +8 -8
- data/bin/commands/completion.rb +61 -19
- data/bin/commands/config.rb +22 -19
- data/bin/commands/done.rb +2 -2
- data/bin/commands/flag.rb +1 -1
- data/bin/commands/grep.rb +6 -33
- data/bin/commands/last.rb +1 -1
- data/bin/commands/meanwhile.rb +2 -2
- data/bin/commands/now.rb +2 -2
- data/bin/commands/on.rb +6 -16
- data/bin/commands/open.rb +1 -1
- data/bin/commands/recent.rb +5 -17
- data/bin/commands/rotate.rb +17 -0
- data/bin/commands/sections.rb +82 -7
- data/bin/commands/show.rb +8 -28
- data/bin/commands/since.rb +5 -16
- data/bin/commands/tag_dir.rb +27 -3
- data/bin/commands/today.rb +3 -28
- data/bin/commands/view.rb +3 -3
- data/bin/commands/yesterday.rb +3 -36
- data/bin/doing +29 -139
- data/docs/doc/Array.html +1 -1
- 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 +1 -1
- data/docs/doc/Doing/Completion.html +324 -4
- data/docs/doc/Doing/Configuration.html +3 -3
- 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 +144 -3
- data/docs/doc/Doing/Items.html +209 -1
- data/docs/doc/Doing/LogAdapter.html +1 -1
- data/docs/doc/Doing/Logger.html +1807 -0
- data/docs/doc/Doing/Note.html +109 -3
- data/docs/doc/Doing/Pager.html +1 -1
- data/docs/doc/Doing/Plugins.html +1 -1
- data/docs/doc/Doing/Prompt.html +1 -1
- data/docs/doc/Doing/Section.html +1 -1
- data/docs/doc/Doing/TemplateString.html +1 -1
- data/docs/doc/Doing/Types.html +3 -3
- data/docs/doc/Doing/Util/Backup.html +1 -1
- data/docs/doc/Doing/Util.html +1 -1
- data/docs/doc/Doing/WWID.html +8 -58
- data/docs/doc/Doing.html +4 -4
- data/docs/doc/FalseClass.html +1 -1
- data/docs/doc/GLI/Commands/Help.html +1 -1
- 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/Object.html +1 -1
- 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 +1 -1
- data/docs/doc/Symbol.html +1 -1
- data/docs/doc/Time.html +1 -1
- data/docs/doc/TrueClass.html +1 -1
- data/docs/doc/_index.html +12 -10
- data/docs/doc/class_list.html +1 -1
- data/docs/doc/file.README.html +2 -2
- data/docs/doc/index.html +2 -2
- data/docs/doc/method_list.html +424 -304
- data/docs/doc/top-level-namespace.html +105 -1
- data/docs/index.md +1 -1
- data/doing.gemspec +24 -24
- data/doing.rdoc +259 -26
- data/example_plugin.rb +7 -5
- data/inputrc +57 -0
- data/lib/completion/_doing.zsh +48 -52
- data/lib/completion/doing.bash +14 -25
- data/lib/completion/doing.fish +41 -15
- data/lib/doing/add_options.rb +152 -0
- data/lib/doing/array/array.rb +16 -0
- data/lib/doing/changelog/changes.rb +1 -1
- data/lib/doing/chronify/string.rb +1 -1
- data/lib/doing/completion/bash_completion.rb +12 -51
- data/lib/doing/completion/fish_completion.rb +17 -53
- data/lib/doing/completion/zsh_completion.rb +21 -59
- data/lib/doing/completion.rb +203 -17
- data/lib/doing/configuration.rb +7 -1
- data/lib/doing/item.rb +30 -5
- data/lib/doing/items.rb +53 -5
- data/lib/doing/{log_adapter.rb → logger.rb} +8 -2
- data/lib/doing/note.rb +24 -8
- data/lib/doing/plugins/export/dayone_export.rb +8 -6
- data/lib/doing/plugins/export/html_export.rb +4 -4
- data/lib/doing/plugins/export/json_export.rb +19 -20
- data/lib/doing/plugins/export/markdown_export.rb +2 -2
- data/lib/doing/plugins/export/template_export.rb +4 -4
- data/lib/doing/plugins/import/calendar_import.rb +2 -2
- data/lib/doing/plugins/import/doing_import.rb +2 -2
- data/lib/doing/plugins/import/timing_import.rb +2 -2
- data/lib/doing/string/highlight.rb +3 -4
- data/lib/doing/string/string.rb +8 -0
- data/lib/doing/string/tags.rb +1 -1
- data/lib/doing/types.rb +2 -2
- data/lib/doing/util.rb +1 -1
- data/lib/doing/util_backup.rb +12 -12
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +119 -120
- data/lib/doing.rb +61 -3
- data/lib/examples/commands/wiki.rb +27 -19
- data/lib/examples/plugins/capture_thing_import.rb +1 -1
- data/lib/helpers/threaded_tests.rb +2 -0
- data/scripts/setting_replace.rb +11 -0
- metadata +109 -124
- data/.yardoc/checksums +0 -29
- data/.yardoc/complete +0 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/bin/commands/add_section.rb +0 -15
data/lib/completion/doing.fish
CHANGED
@@ -135,7 +135,6 @@ end
|
|
135
135
|
|
136
136
|
__fish_doing_complete_args tag
|
137
137
|
|
138
|
-
complete -xc doing -n '__fish_doing_needs_command' -a 'add_section' -d Add\ a\ new\ section\ to\ the\ \"doing\"\ file
|
139
138
|
complete -xc doing -n '__fish_doing_needs_command' -a 'again resume' -d Repeat\ last\ entry\ as\ new\ entry
|
140
139
|
complete -xc doing -n '__fish_doing_needs_command' -a 'archive move' -d Move\ entries\ between\ sections
|
141
140
|
complete -xc doing -n '__fish_doing_needs_command' -a 'autotag' -d Autotag\ last\ entry\ or\ filtered\ entries
|
@@ -143,7 +142,7 @@ complete -xc doing -n '__fish_doing_needs_command' -a 'cancel' -d End\ last\ X\
|
|
143
142
|
complete -xc doing -n '__fish_doing_needs_command' -a 'changes changelog' -d List\ recent\ changes\ in\ Doing
|
144
143
|
complete -xc doing -n '__fish_doing_needs_command' -a 'colors' -d List\ available\ color\ variables\ for\ configuration\ templates\ and\ views
|
145
144
|
complete -xc doing -n '__fish_doing_needs_command' -a 'commands' -d Enable\ and\ disable\ Doing\ commands
|
146
|
-
complete -xc doing -n '__fish_doing_needs_command' -a 'completion' -d Generate\ shell\ completion\ scripts
|
145
|
+
complete -xc doing -n '__fish_doing_needs_command' -a 'completion' -d Generate\ shell\ completion\ scripts\ for\ doing
|
147
146
|
complete -xc doing -n '__fish_doing_needs_command' -a 'config' -d Edit\ the\ configuration\ file\ or\ output\ a\ value\ from\ it
|
148
147
|
complete -xc doing -n '__fish_doing_needs_command' -a 'done did' -d Add\ a\ completed\ item\ with\ @done\(date\)
|
149
148
|
complete -xc doing -n '__fish_doing_needs_command' -a 'finish' -d Mark\ last\ X\ entries\ as\ @done
|
@@ -162,7 +161,7 @@ complete -xc doing -n '__fish_doing_needs_command' -a 'recent' -d List\ recent\
|
|
162
161
|
complete -xc doing -n '__fish_doing_needs_command' -a 'redo' -d Redo\ an\ undo\ command
|
163
162
|
complete -xc doing -n '__fish_doing_needs_command' -a 'reset begin' -d Reset\ the\ start\ time\ of\ an\ entry
|
164
163
|
complete -xc doing -n '__fish_doing_needs_command' -a 'rotate' -d Move\ entries\ to\ archive\ file
|
165
|
-
complete -xc doing -n '__fish_doing_needs_command' -a 'sections' -d List
|
164
|
+
complete -xc doing -n '__fish_doing_needs_command' -a 'sections' -d List
|
166
165
|
complete -xc doing -n '__fish_doing_needs_command' -a 'select' -d Display\ an\ interactive\ menu\ to\ perform\ operations
|
167
166
|
complete -xc doing -n '__fish_doing_needs_command' -a 'show' -d List\ all\ entries
|
168
167
|
complete -xc doing -n '__fish_doing_needs_command' -a 'since' -d List\ entries\ since\ a\ date
|
@@ -232,8 +231,7 @@ complete -c doing -l markdown -f -n '__fish_doing_using_command changes change
|
|
232
231
|
complete -c doing -l render -f -n '__fish_doing_using_command changes changelog' -d Force\ rendered\ output
|
233
232
|
complete -c doing -l search -s s -f -r -n '__fish_doing_using_command changes changelog' -d Show\ changelogs\ matching\ search\ terms
|
234
233
|
complete -c doing -l sort -f -r -n '__fish_doing_using_command changes changelog' -d Sort\ order
|
235
|
-
complete -c doing -l
|
236
|
-
complete -c doing -l type -s t -f -r -n '__fish_doing_using_command completion' -d Shell\ to\ generate\ for
|
234
|
+
complete -c doing -l type -s t -f -r -n '__fish_doing_using_command completion' -d Deprecated
|
237
235
|
complete -c doing -l dump -s d -f -n '__fish_doing_using_command config' -d DEPRECATED
|
238
236
|
complete -c doing -l update -s u -f -n '__fish_doing_using_command config' -d DEPRECATED
|
239
237
|
complete -c doing -l noauto -s X -f -n '__fish_doing_using_command done did' -d Exclude\ auto\ tags\ and\ default\ tags
|
@@ -269,7 +267,7 @@ complete -c doing -l val -f -r -n '__fish_doing_using_command finish' -d Perfor
|
|
269
267
|
complete -c doing -l exact -s x -f -n '__fish_doing_using_command finish' -d Force\ exact\ search\ string\ matching
|
270
268
|
complete -c doing -l after -f -r -n '__fish_doing_using_command grep search' -d Search\ entries\ newer\ than\ date
|
271
269
|
complete -c doing -l before -f -r -n '__fish_doing_using_command grep search' -d Search\ entries\ older\ than\ date
|
272
|
-
complete -c doing -l bool -f -r -n '__fish_doing_using_command grep search' -d
|
270
|
+
complete -c doing -l bool -f -r -n '__fish_doing_using_command grep search' -d Boolean\ used\ to\ combine\ multiple\ tags
|
273
271
|
complete -c doing -l case -f -r -n '__fish_doing_using_command grep search' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
274
272
|
complete -c doing -l config_template -f -r -n '__fish_doing_using_command grep search' -d Output\ using\ a\ template\ from\ configuration
|
275
273
|
complete -c doing -l delete -s d -f -n '__fish_doing_using_command grep search' -d Delete\ matching\ entries
|
@@ -278,14 +276,16 @@ complete -c doing -l editor -s e -f -n '__fish_doing_using_command grep search'
|
|
278
276
|
complete -c doing -l from -f -r -n '__fish_doing_using_command grep search' -d Date\ range
|
279
277
|
complete -c doing -l hilite -s h -f -n '__fish_doing_using_command grep search' -d Highlight\ search\ matches\ in\ output
|
280
278
|
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
|
281
|
-
complete -c doing -l not -f -n '__fish_doing_using_command grep search' -d
|
279
|
+
complete -c doing -l not -f -n '__fish_doing_using_command grep search' -d Search\ items\ that\ \*don\'t\*\ match\ search/tag\ filters
|
282
280
|
complete -c doing -l output -s o -f -r -n '__fish_doing_using_command grep search' -d Output\ to\ export\ format
|
283
281
|
complete -c doing -l only_timed -f -n '__fish_doing_using_command grep search' -d Only\ show\ items\ with\ recorded\ time\ intervals
|
284
282
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command grep search' -d Section
|
285
283
|
complete -c doing -l times -s t -f -n '__fish_doing_using_command grep search' -d Show\ time\ intervals\ on\ @done\ tasks
|
284
|
+
complete -c doing -l tag -f -r -n '__fish_doing_using_command grep search' -d Filter\ entries\ by\ tag
|
285
|
+
complete -c doing -l tag_order -f -r -n '__fish_doing_using_command grep search' -d Tag\ sort\ direction
|
286
286
|
complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command grep search' -d Sort\ tags\ by
|
287
287
|
complete -c doing -l template -f -r -n '__fish_doing_using_command grep search' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
|
288
|
-
complete -c doing -l totals -f -n '__fish_doing_using_command grep search' -d Show\
|
288
|
+
complete -c doing -l totals -f -n '__fish_doing_using_command grep search' -d Show\ time\ totals\ at\ the\ end\ of\ output
|
289
289
|
complete -c doing -l val -f -r -n '__fish_doing_using_command grep search' -d Perform\ a\ tag\ value\ query
|
290
290
|
complete -c doing -l exact -s x -f -n '__fish_doing_using_command grep search' -d Force\ exact\ string\ matching
|
291
291
|
complete -c doing -F -n '__fish_doing_using_command import'
|
@@ -358,14 +358,26 @@ complete -c doing -l finish_last -s f -f -n '__fish_doing_using_command now nex
|
|
358
358
|
complete -c doing -l from -f -r -n '__fish_doing_using_command now next' -d Set\ a\ start\ and\ optionally\ end\ time\ as\ a\ date\ range
|
359
359
|
complete -c doing -l note -s n -f -r -n '__fish_doing_using_command now next' -d Include\ a\ note
|
360
360
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command now next' -d Section
|
361
|
+
complete -c doing -l after -f -r -n '__fish_doing_using_command on' -d View\ entries\ after\ specified\ time
|
362
|
+
complete -c doing -l before -f -r -n '__fish_doing_using_command on' -d View\ entries\ before\ specified\ time
|
363
|
+
complete -c doing -l bool -f -r -n '__fish_doing_using_command on' -d Boolean\ used\ to\ combine\ multiple\ tags
|
364
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command on' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
361
365
|
complete -c doing -l config_template -f -r -n '__fish_doing_using_command on' -d Output\ using\ a\ template\ from\ configuration
|
362
366
|
complete -c doing -l duration -f -n '__fish_doing_using_command on' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
|
367
|
+
complete -c doing -l from -f -r -n '__fish_doing_using_command on' -d Time\ range\ to\ show\ \`doing\ on\ --from\ \"12pm\ to\ 4pm\"\`
|
368
|
+
complete -c doing -l not -f -n '__fish_doing_using_command on' -d Show\ items\ that\ \*don\'t\*\ match\ search/tag\ filters
|
363
369
|
complete -c doing -l output -s o -f -r -n '__fish_doing_using_command on' -d Output\ to\ export\ format
|
370
|
+
complete -c doing -l only_timed -f -n '__fish_doing_using_command on' -d Only\ show\ items\ with\ recorded\ time\ intervals
|
364
371
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command on' -d Section
|
372
|
+
complete -c doing -l search -f -r -n '__fish_doing_using_command on' -d Filter\ entries\ using\ a\ search\ query
|
365
373
|
complete -c doing -l times -s t -f -n '__fish_doing_using_command on' -d Show\ time\ intervals\ on\ @done\ tasks
|
374
|
+
complete -c doing -l tag -f -r -n '__fish_doing_using_command on' -d Filter\ entries\ by\ tag
|
375
|
+
complete -c doing -l tag_order -f -r -n '__fish_doing_using_command on' -d Tag\ sort\ direction
|
366
376
|
complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command on' -d Sort\ tags\ by
|
367
377
|
complete -c doing -l template -f -r -n '__fish_doing_using_command on' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
|
368
378
|
complete -c doing -l totals -f -n '__fish_doing_using_command on' -d Show\ time\ totals\ at\ the\ end\ of\ output
|
379
|
+
complete -c doing -l val -f -r -n '__fish_doing_using_command on' -d Perform\ a\ tag\ value\ query
|
380
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command on' -d Force\ exact\ search\ string\ matching
|
369
381
|
complete -c doing -l app -s a -f -r -n '__fish_doing_using_command open' -d Open\ with\ app\ name
|
370
382
|
complete -c doing -l bundle_id -s b -f -r -n '__fish_doing_using_command open' -d Open\ with\ app\ bundle\ id
|
371
383
|
complete -c doing -l editor -s e -f -r -n '__fish_doing_using_command open' -d Open\ with\ editor\ command
|
@@ -374,11 +386,13 @@ complete -c doing -l type -s t -f -r -n '__fish_doing_using_command plugins' -d
|
|
374
386
|
complete -c doing -l config_template -f -r -n '__fish_doing_using_command recent' -d Output\ using\ a\ template\ from\ configuration
|
375
387
|
complete -c doing -l duration -f -n '__fish_doing_using_command recent' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
|
376
388
|
complete -c doing -l interactive -s i -f -n '__fish_doing_using_command recent' -d Select\ from\ a\ menu\ of\ matching\ entries\ to\ perform\ additional\ operations
|
389
|
+
complete -c doing -l only_timed -f -n '__fish_doing_using_command recent' -d Only\ show\ items\ with\ recorded\ time\ intervals
|
377
390
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command recent' -d Section
|
378
391
|
complete -c doing -l times -s t -f -n '__fish_doing_using_command recent' -d Show\ time\ intervals\ on\ @done\ tasks
|
392
|
+
complete -c doing -l tag_order -f -r -n '__fish_doing_using_command recent' -d Tag\ sort\ direction
|
379
393
|
complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command recent' -d Sort\ tags\ by
|
380
394
|
complete -c doing -l template -f -r -n '__fish_doing_using_command recent' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
|
381
|
-
complete -c doing -l totals -f -n '__fish_doing_using_command recent' -d Show\
|
395
|
+
complete -c doing -l totals -f -n '__fish_doing_using_command recent' -d Show\ time\ totals\ at\ the\ end\ of\ output
|
382
396
|
complete -c doing -l file -s f -f -r -n '__fish_doing_using_command redo' -d Specify\ alternate\ doing\ file
|
383
397
|
complete -c doing -l interactive -s i -f -n '__fish_doing_using_command redo' -d Select\ from\ an\ interactive\ menu
|
384
398
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command reset begin' -d Boolean\ used\ to\ combine\ multiple\ tags
|
@@ -401,7 +415,6 @@ complete -c doing -l search -f -r -n '__fish_doing_using_command rotate' -d Fil
|
|
401
415
|
complete -c doing -l tag -f -r -n '__fish_doing_using_command rotate' -d Filter\ entries\ by\ tag
|
402
416
|
complete -c doing -l val -f -r -n '__fish_doing_using_command rotate' -d Perform\ a\ tag\ value\ query
|
403
417
|
complete -c doing -l exact -s x -f -n '__fish_doing_using_command rotate' -d Force\ exact\ search\ string\ matching
|
404
|
-
complete -c doing -l column -s c -f -n '__fish_doing_using_command sections' -d List\ in\ single\ column
|
405
418
|
complete -c doing -l archive -s a -f -n '__fish_doing_using_command select' -d Archive\ selected\ items
|
406
419
|
complete -c doing -l after -f -r -n '__fish_doing_using_command select' -d Select\ entries\ newer\ than\ date
|
407
420
|
complete -c doing -l resume -f -n '__fish_doing_using_command select' -d Copy\ selection\ as\ a\ new\ entry\ with\ current\ time\ and\ no\ @done\ tag
|
@@ -448,17 +461,26 @@ complete -c doing -l tag -f -r -n '__fish_doing_using_command show' -d Filter\
|
|
448
461
|
complete -c doing -l tag_order -f -r -n '__fish_doing_using_command show' -d Tag\ sort\ direction
|
449
462
|
complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command show' -d Sort\ tags\ by
|
450
463
|
complete -c doing -l template -f -r -n '__fish_doing_using_command show' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
|
451
|
-
complete -c doing -l totals -f -n '__fish_doing_using_command show' -d Show\
|
464
|
+
complete -c doing -l totals -f -n '__fish_doing_using_command show' -d Show\ time\ totals\ at\ the\ end\ of\ output
|
452
465
|
complete -c doing -l val -f -r -n '__fish_doing_using_command show' -d Perform\ a\ tag\ value\ query
|
453
466
|
complete -c doing -l exact -s x -f -n '__fish_doing_using_command show' -d Force\ exact\ search\ string\ matching
|
467
|
+
complete -c doing -l bool -f -r -n '__fish_doing_using_command since' -d Boolean\ used\ to\ combine\ multiple\ tags
|
468
|
+
complete -c doing -l case -f -r -n '__fish_doing_using_command since' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
454
469
|
complete -c doing -l config_template -f -r -n '__fish_doing_using_command since' -d Output\ using\ a\ template\ from\ configuration
|
455
470
|
complete -c doing -l duration -f -n '__fish_doing_using_command since' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
|
471
|
+
complete -c doing -l not -f -n '__fish_doing_using_command since' -d Since\ items\ that\ \*don\'t\*\ match\ search/tag\ filters
|
456
472
|
complete -c doing -l output -s o -f -r -n '__fish_doing_using_command since' -d Output\ to\ export\ format
|
473
|
+
complete -c doing -l only_timed -f -n '__fish_doing_using_command since' -d Only\ show\ items\ with\ recorded\ time\ intervals
|
457
474
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command since' -d Section
|
475
|
+
complete -c doing -l search -f -r -n '__fish_doing_using_command since' -d Filter\ entries\ using\ a\ search\ query
|
458
476
|
complete -c doing -l times -s t -f -n '__fish_doing_using_command since' -d Show\ time\ intervals\ on\ @done\ tasks
|
477
|
+
complete -c doing -l tag -f -r -n '__fish_doing_using_command since' -d Filter\ entries\ by\ tag
|
478
|
+
complete -c doing -l tag_order -f -r -n '__fish_doing_using_command since' -d Tag\ sort\ direction
|
459
479
|
complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command since' -d Sort\ tags\ by
|
460
480
|
complete -c doing -l template -f -r -n '__fish_doing_using_command since' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
|
461
481
|
complete -c doing -l totals -f -n '__fish_doing_using_command since' -d Show\ time\ totals\ at\ the\ end\ of\ output
|
482
|
+
complete -c doing -l val -f -r -n '__fish_doing_using_command since' -d Perform\ a\ tag\ value\ query
|
483
|
+
complete -c doing -l exact -s x -f -n '__fish_doing_using_command since' -d Force\ exact\ search\ string\ matching
|
462
484
|
complete -c doing -l autotag -s a -f -n '__fish_doing_using_command tag' -d Autotag\ entries\ based\ on\ autotag\ configuration\ in\ \~/
|
463
485
|
complete -c doing -l bool -f -r -n '__fish_doing_using_command tag' -d Boolean\ used\ to\ combine\ multiple\ tags
|
464
486
|
complete -c doing -l count -s c -f -r -n '__fish_doing_using_command tag' -d How\ many\ recent\ entries\ to\ tag
|
@@ -501,8 +523,10 @@ complete -c doing -l config_template -f -r -n '__fish_doing_using_command today
|
|
501
523
|
complete -c doing -l duration -f -n '__fish_doing_using_command today' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
|
502
524
|
complete -c doing -l from -f -r -n '__fish_doing_using_command today' -d Time\ range\ to\ show\ \`doing\ today\ --from\ \"12pm\ to\ 4pm\"\`
|
503
525
|
complete -c doing -l output -s o -f -r -n '__fish_doing_using_command today' -d Output\ to\ export\ format
|
526
|
+
complete -c doing -l only_timed -f -n '__fish_doing_using_command today' -d Only\ show\ items\ with\ recorded\ time\ intervals
|
504
527
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command today' -d Specify\ a\ section
|
505
528
|
complete -c doing -l times -s t -f -n '__fish_doing_using_command today' -d Show\ time\ intervals\ on\ @done\ tasks
|
529
|
+
complete -c doing -l tag_order -f -r -n '__fish_doing_using_command today' -d Tag\ sort\ direction
|
506
530
|
complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command today' -d Sort\ tags\ by
|
507
531
|
complete -c doing -l template -f -r -n '__fish_doing_using_command today' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
|
508
532
|
complete -c doing -l totals -f -n '__fish_doing_using_command today' -d Show\ time\ totals\ at\ the\ end\ of\ output
|
@@ -546,8 +570,9 @@ complete -c doing -l after -f -r -n '__fish_doing_using_command yesterday' -d V
|
|
546
570
|
complete -c doing -l before -f -r -n '__fish_doing_using_command yesterday' -d View\ entries\ before\ specified\ time
|
547
571
|
complete -c doing -l config_template -f -r -n '__fish_doing_using_command yesterday' -d Output\ using\ a\ template\ from\ configuration
|
548
572
|
complete -c doing -l duration -f -n '__fish_doing_using_command yesterday' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
|
549
|
-
complete -c doing -l from -f -r -n '__fish_doing_using_command yesterday' -d Time\ range\ to\ show
|
573
|
+
complete -c doing -l from -f -r -n '__fish_doing_using_command yesterday' -d Time\ range\ to\ show\ \`doing\ yesterday\ --from\ \"12pm\ to\ 4pm\"\`
|
550
574
|
complete -c doing -l output -s o -f -r -n '__fish_doing_using_command yesterday' -d Output\ to\ export\ format
|
575
|
+
complete -c doing -l only_timed -f -n '__fish_doing_using_command yesterday' -d Only\ show\ items\ with\ recorded\ time\ intervals
|
551
576
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command yesterday' -d Specify\ a\ section
|
552
577
|
complete -c doing -l times -s t -f -n '__fish_doing_using_command yesterday' -d Show\ time\ intervals\ on\ @done\ tasks
|
553
578
|
complete -c doing -l tag_order -f -r -n '__fish_doing_using_command yesterday' -d Tag\ sort\ direction
|
@@ -555,9 +580,10 @@ complete -c doing -l tag_sort -f -r -n '__fish_doing_using_command yesterday' -
|
|
555
580
|
complete -c doing -l template -f -r -n '__fish_doing_using_command yesterday' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
|
556
581
|
complete -c doing -l totals -f -n '__fish_doing_using_command yesterday' -d Show\ time\ totals\ at\ the\ end\ of\ output
|
557
582
|
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)'
|
558
|
-
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'
|
559
|
-
complete -f -c doing -l case -x -n '__fish_doing_using_command again resume archive move cancel
|
583
|
+
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 on reset begin rotate show since tag tags view wiki' -a 'and or not pattern'
|
584
|
+
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 on reset begin rotate select show since tag tags view' -a 'case-sensitive ignore smart'
|
585
|
+
complete -f -c doing -l sort -x -n '__fish_doing_using_command changes changelog show tags' -a 'asc desc'
|
560
586
|
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'
|
561
|
-
complete -f -c doing -l tag_order -x -n '__fish_doing_using_command show view yesterday' -a 'asc desc'
|
587
|
+
complete -f -c doing -l tag_order -x -n '__fish_doing_using_command grep search on recent show since today view yesterday' -a 'asc desc'
|
562
588
|
complete -f -c doing -s a -l age -x -n '__fish_doing_using_command show view' -a 'oldest newest'
|
563
589
|
complete -f -c doing -s s -l section -x -n '__fish_doing_using_command again resume autotag cancel done did finish grep search import last mark flag meanwhile note now next on recent reset begin rotate select since tag tags today view wiki yesterday' -a '(__fish_doing_complete_sections)'
|
@@ -0,0 +1,152 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
##
|
4
|
+
## Add presets of flags and switches to a command.
|
5
|
+
##
|
6
|
+
## :add_entry => --noauto, --note, --ask, --editor, --back
|
7
|
+
##
|
8
|
+
## :search => --search, --case, --exact
|
9
|
+
##
|
10
|
+
## :tag_filter => --tag, --bool, --not, --val
|
11
|
+
##
|
12
|
+
## :date_filter => --before, --after, --from
|
13
|
+
##
|
14
|
+
## @param type [Symbol] The type
|
15
|
+
## @param cmd The GLI command to which the options will be added
|
16
|
+
##
|
17
|
+
def add_options(type, cmd)
|
18
|
+
cmd_name = cmd.name.to_s
|
19
|
+
action = case cmd_name
|
20
|
+
when /again/
|
21
|
+
'Repeat'
|
22
|
+
when /grep/
|
23
|
+
'Search'
|
24
|
+
when /mark/
|
25
|
+
'Flag'
|
26
|
+
when /(last|tags|view|on)/
|
27
|
+
'Show'
|
28
|
+
else
|
29
|
+
cmd_name.capitalize
|
30
|
+
end
|
31
|
+
|
32
|
+
case type
|
33
|
+
when :add_entry
|
34
|
+
cmd.desc 'Exclude auto tags and default tags'
|
35
|
+
cmd.switch %i[X noauto], default_value: false, negatable: false
|
36
|
+
|
37
|
+
cmd.desc 'Include a note'
|
38
|
+
cmd.arg_name 'TEXT'
|
39
|
+
cmd.flag %i[n note]
|
40
|
+
|
41
|
+
cmd.desc 'Prompt for note via multi-line input'
|
42
|
+
cmd.switch %i[ask], negatable: false, default_value: false
|
43
|
+
|
44
|
+
cmd.desc "Edit entry with #{Doing::Util.default_editor}"
|
45
|
+
cmd.switch %i[e editor], negatable: false, default_value: false
|
46
|
+
|
47
|
+
cmd.desc 'Backdate start date for new entry to date string [4pm|20m|2h|yesterday noon]'
|
48
|
+
cmd.arg_name 'DATE_STRING'
|
49
|
+
cmd.flag %i[b back started], type: DateBeginString
|
50
|
+
when :search
|
51
|
+
cmd.desc 'Filter entries using a search query, surround with slashes for regex (e.g. "/query.*/"),
|
52
|
+
start with single quote for exact match ("\'query")'
|
53
|
+
cmd.arg_name 'QUERY'
|
54
|
+
cmd.flag [:search]
|
55
|
+
|
56
|
+
cmd.desc 'Case sensitivity for search string matching [(c)ase-sensitive, (i)gnore, (s)mart]'
|
57
|
+
cmd.arg_name 'TYPE'
|
58
|
+
cmd.flag [:case], must_match: REGEX_CASE,
|
59
|
+
default_value: Doing.settings.dig('search', 'case').normalize_case,
|
60
|
+
type: CaseSymbol
|
61
|
+
|
62
|
+
cmd.desc 'Force exact search string matching (case sensitive)'
|
63
|
+
cmd.switch %i[x exact], default_value: Doing.config.exact_match?, negatable: Doing.config.exact_match?
|
64
|
+
when :time_display
|
65
|
+
cmd.desc 'Show time intervals on @done tasks'
|
66
|
+
cmd.switch %i[t times], default_value: true, negatable: true
|
67
|
+
|
68
|
+
cmd.desc 'Show elapsed time on entries without @done tag'
|
69
|
+
cmd.switch [:duration]
|
70
|
+
|
71
|
+
cmd.desc 'Show time totals at the end of output'
|
72
|
+
cmd.switch [:totals], default_value: false, negatable: false
|
73
|
+
|
74
|
+
cmd.desc 'Sort tags by (name|time)'
|
75
|
+
default = Doing.setting('tag_sort').normalize_tag_sort || :name
|
76
|
+
cmd.arg_name 'KEY'
|
77
|
+
cmd.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
|
78
|
+
|
79
|
+
cmd.desc 'Tag sort direction (asc|desc)'
|
80
|
+
cmd.arg_name 'DIRECTION'
|
81
|
+
cmd.flag [:tag_order], must_match: REGEX_SORT_ORDER, default_value: :asc, type: OrderSymbol
|
82
|
+
|
83
|
+
cmd.desc 'Only show items with recorded time intervals'
|
84
|
+
cmd.switch [:only_timed], default_value: false, negatable: false
|
85
|
+
when :tag_filter
|
86
|
+
cmd.desc 'Filter entries by tag. Combine multiple tags with a comma. Wildcards allowed (*, ?)'
|
87
|
+
cmd.arg_name 'TAG'
|
88
|
+
cmd.flag [:tag], type: TagArray
|
89
|
+
|
90
|
+
cmd.desc 'Perform a tag value query ("@done > two hours ago" or "@progress < 50").
|
91
|
+
May be used multiple times, combined with --bool'
|
92
|
+
cmd.arg_name 'QUERY'
|
93
|
+
cmd.flag [:val], multiple: true, must_match: REGEX_VALUE_QUERY
|
94
|
+
|
95
|
+
cmd.desc "#{action} items that *don't* match search/tag filters"
|
96
|
+
cmd.switch [:not], default_value: false, negatable: false
|
97
|
+
|
98
|
+
cmd.desc 'Boolean used to combine multiple tags. Use PATTERN to parse + and - as booleans'
|
99
|
+
cmd.arg_name 'BOOLEAN'
|
100
|
+
cmd.flag [:bool], must_match: REGEX_BOOL,
|
101
|
+
default_value: :pattern,
|
102
|
+
type: BooleanSymbol
|
103
|
+
when :time_filter
|
104
|
+
cmd.desc 'View entries before specified time (e.g. 8am, 12:30pm, 15:00)'
|
105
|
+
cmd.arg_name 'TIME_STRING'
|
106
|
+
cmd.flag [:before], type: DateEndString
|
107
|
+
|
108
|
+
cmd.desc 'View entries after specified time (e.g. 8am, 12:30pm, 15:00)'
|
109
|
+
cmd.arg_name 'TIME_STRING'
|
110
|
+
cmd.flag [:after], type: DateBeginString
|
111
|
+
|
112
|
+
cmd.desc %(
|
113
|
+
Time range to show `doing #{cmd.name} --from "12pm to 4pm"`
|
114
|
+
)
|
115
|
+
cmd.arg_name 'TIME_RANGE'
|
116
|
+
cmd.flag [:from], type: DateRangeString, must_match: REGEX_TIME_RANGE
|
117
|
+
when :date_filter
|
118
|
+
if action =~ /Archive/
|
119
|
+
cmd.desc 'Archive entries older than date (natural language).'
|
120
|
+
else
|
121
|
+
cmd.desc "#{action} entries older than date (natural language). If this is only a time (8am, 1:30pm, 15:00), all
|
122
|
+
dates will be included, but entries will be filtered by time of day"
|
123
|
+
end
|
124
|
+
cmd.arg_name 'DATE_STRING'
|
125
|
+
cmd.flag [:before], type: DateBeginString
|
126
|
+
|
127
|
+
if action =~ /Archive/
|
128
|
+
cmd.desc 'Archive entries newer than date (natural language).'
|
129
|
+
else
|
130
|
+
cmd.desc "#{action} entries newer than date (natural language). If this is only a time (8am, 1:30pm, 15:00), all
|
131
|
+
dates will be included, but entries will be filtered by time of day"
|
132
|
+
end
|
133
|
+
cmd.arg_name 'DATE_STRING'
|
134
|
+
cmd.flag [:after], type: DateEndString
|
135
|
+
|
136
|
+
if action =~ /Archive/
|
137
|
+
cmd.desc %(
|
138
|
+
Date range (natural language) to archive: `doing archive --from "1/1/21 to 12/31/21"`.
|
139
|
+
)
|
140
|
+
else
|
141
|
+
cmd.desc %(
|
142
|
+
Date range (natural language) to #{action.downcase}, or a single day to filter on.
|
143
|
+
To specify a range, use "to": `doing #{cmd_name} --from "monday 8am to friday 5pm"`.
|
144
|
+
|
145
|
+
If values are only time(s) (6am to noon) all dates will be included, but entries will be filtered
|
146
|
+
by time of day.
|
147
|
+
)
|
148
|
+
end
|
149
|
+
cmd.arg_name 'DATE_OR_RANGE'
|
150
|
+
cmd.flag [:from], type: DateRangeString
|
151
|
+
end
|
152
|
+
end
|
data/lib/doing/array/array.rb
CHANGED
@@ -2,3 +2,19 @@
|
|
2
2
|
|
3
3
|
require_relative 'tags'
|
4
4
|
require_relative 'nested_hash'
|
5
|
+
|
6
|
+
class ::Array
|
7
|
+
##
|
8
|
+
## Force UTF-8 encoding of strings in array
|
9
|
+
##
|
10
|
+
## @return [Array] Encoded lines
|
11
|
+
##
|
12
|
+
def utf8
|
13
|
+
c = self.class
|
14
|
+
if String.method_defined? :force_encoding
|
15
|
+
replace c.new(map(&:utf8))
|
16
|
+
else
|
17
|
+
self
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -43,7 +43,7 @@ module Doing
|
|
43
43
|
|
44
44
|
def to_s
|
45
45
|
if @changes_only
|
46
|
-
@changes.map(&:changes_only).join().force_encoding('utf-8')
|
46
|
+
@changes.map(&:changes_only).delete_if(&:empty?).join().gsub(/\n+/, "\n").force_encoding('utf-8')
|
47
47
|
else
|
48
48
|
@changes.map(&:to_s).join("\n\n").force_encoding('utf-8')
|
49
49
|
end
|
@@ -200,7 +200,7 @@ module Doing
|
|
200
200
|
else
|
201
201
|
if date_string.strip =~ time_rx
|
202
202
|
start = date_string.strip
|
203
|
-
finish =
|
203
|
+
finish = '11:59pm'
|
204
204
|
else
|
205
205
|
start = date_string.strip.chronify(guess: :begin, future: false)
|
206
206
|
finish = date_string.strip.chronify(guess: :end)
|
@@ -1,5 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Doing
|
2
4
|
module Completion
|
5
|
+
# Generate completions for Bash
|
3
6
|
class BashCompletions
|
4
7
|
attr_accessor :commands, :global_options
|
5
8
|
|
@@ -11,7 +14,7 @@ module Doing
|
|
11
14
|
@commands.each_with_index do |cmd, i|
|
12
15
|
@bar.advance(status: cmd[:commands].first)
|
13
16
|
|
14
|
-
data = get_help_sections(cmd[:commands].first)
|
17
|
+
data = Completion.get_help_sections(cmd[:commands].first)
|
15
18
|
|
16
19
|
arg = data[:synopsis].join(' ').strip.split(/ /).last
|
17
20
|
case arg
|
@@ -26,7 +29,7 @@ module Doing
|
|
26
29
|
end
|
27
30
|
|
28
31
|
if data[:command_options]
|
29
|
-
options = parse_options(data[:command_options])
|
32
|
+
options = Completion.parse_options(data[:command_options])
|
30
33
|
out << command_function(cmd[:commands].first, options, type)
|
31
34
|
|
32
35
|
if first
|
@@ -119,56 +122,13 @@ module Doing
|
|
119
122
|
[func, logic]
|
120
123
|
end
|
121
124
|
|
122
|
-
|
123
|
-
|
124
|
-
def get_help_sections(command = '')
|
125
|
-
res = `doing help #{command}`.strip
|
126
|
-
scanned = res.scan(/(?m-i)^([A-Z ]+)\n([\s\S]*?)(?=\n+[A-Z]+|\Z)/)
|
127
|
-
sections = {}
|
128
|
-
scanned.each do |sect|
|
129
|
-
title = sect[0].downcase.strip.gsub(/ +/, '_').to_sym
|
130
|
-
content = sect[1].split(/\n/).map(&:strip).delete_if(&:empty?)
|
131
|
-
sections[title] = content
|
132
|
-
end
|
133
|
-
sections
|
134
|
-
end
|
135
|
-
|
136
|
-
def parse_option(option)
|
137
|
-
res = option.match(/(?:-(?<short>\w), )?(?:--(?:\[no-\])?(?<long>\w+)(?:=(?<arg>\w+))?)\s+- (?<desc>.*?)$/)
|
138
|
-
return nil unless res
|
139
|
-
{
|
140
|
-
short: res['short'],
|
141
|
-
long: res['long'],
|
142
|
-
arg: res[:arg],
|
143
|
-
description: res['desc'].short_desc
|
144
|
-
}
|
145
|
-
end
|
146
|
-
|
147
|
-
def parse_options(options)
|
148
|
-
options.map { |opt| parse_option(opt) }
|
149
|
-
end
|
150
|
-
|
151
|
-
def parse_command(command)
|
152
|
-
res = command.match(/^(?<cmd>[^, \t]+)(?<alias>(?:, [^, \t]+)*)?\s+- (?<desc>.*?)$/)
|
153
|
-
commands = [res['cmd']]
|
154
|
-
commands.concat(res['alias'].split(/, /).delete_if(&:empty?)) if res['alias']
|
155
|
-
|
156
|
-
{
|
157
|
-
commands: commands,
|
158
|
-
description: res['desc'].short_desc
|
159
|
-
}
|
160
|
-
end
|
161
|
-
|
162
|
-
def parse_commands(commands)
|
163
|
-
commands.map { |cmd| parse_command(cmd) }
|
164
|
-
end
|
165
|
-
|
166
125
|
def initialize
|
167
|
-
data = get_help_sections
|
168
|
-
@global_options = parse_options(data[:global_options])
|
169
|
-
@commands = parse_commands(data[:commands])
|
170
|
-
@bar = TTY::ProgressBar.new("\033[0;0;33mGenerating Bash completions: \033[0;35;40m[:bar] :status\033[0m", total: @commands.count, bar_format: :
|
171
|
-
|
126
|
+
data = Completion.get_help_sections
|
127
|
+
@global_options = Completion.parse_options(data[:global_options])
|
128
|
+
@commands = Completion.parse_commands(data[:commands])
|
129
|
+
@bar = TTY::ProgressBar.new("\033[0;0;33mGenerating Bash completions: \033[0;35;40m[:bar] :status\033[0m", total: @commands.count + 1, bar_format: :square, hide_cursor: true, status: 'Reading subcommands')
|
130
|
+
width = TTY::Screen.columns - 45
|
131
|
+
@bar.resize(width)
|
172
132
|
end
|
173
133
|
|
174
134
|
def generate_completions
|
@@ -176,6 +136,7 @@ module Doing
|
|
176
136
|
out = []
|
177
137
|
out << main_function
|
178
138
|
out << 'complete -F _doing doing'
|
139
|
+
@bar.advance(status: '✅')
|
179
140
|
@bar.finish
|
180
141
|
out.join("\n")
|
181
142
|
end
|
@@ -1,5 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Doing
|
2
4
|
module Completion
|
5
|
+
# Generate completions for Fish
|
3
6
|
class FishCompletions
|
4
7
|
|
5
8
|
attr_accessor :commands, :global_options
|
@@ -137,53 +140,12 @@ module Doing
|
|
137
140
|
EOFUNCTIONS
|
138
141
|
end
|
139
142
|
|
140
|
-
def get_help_sections(command = '')
|
141
|
-
res = `doing help #{command}`.strip
|
142
|
-
scanned = res.scan(/(?m-i)^([A-Z ]+)\n([\s\S]*?)(?=\n+[A-Z]+|\Z)/)
|
143
|
-
sections = {}
|
144
|
-
scanned.each do |sect|
|
145
|
-
title = sect[0].downcase.strip.gsub(/ +/, '_').to_sym
|
146
|
-
content = sect[1].split(/\n/).map(&:strip).delete_if(&:empty?)
|
147
|
-
sections[title] = content
|
148
|
-
end
|
149
|
-
sections
|
150
|
-
end
|
151
|
-
|
152
|
-
def parse_option(option)
|
153
|
-
res = option.match(/(?:-(?<short>\w), )?(?:--(?:\[no-\])?(?<long>\w+)(?:=(?<arg>\w+))?)\s+- (?<desc>.*?)$/)
|
154
|
-
return nil unless res
|
155
|
-
|
156
|
-
{
|
157
|
-
short: res['short'],
|
158
|
-
long: res['long'],
|
159
|
-
arg: res['arg'],
|
160
|
-
description: res['desc'].short_desc
|
161
|
-
}
|
162
|
-
end
|
163
|
-
|
164
|
-
def parse_options(options)
|
165
|
-
options.map { |opt| parse_option(opt) }
|
166
|
-
end
|
167
|
-
|
168
|
-
def parse_command(command)
|
169
|
-
res = command.match(/^(?<cmd>[^, \t]+)(?<alias>(?:, [^, \t]+)*)?\s+- (?<desc>.*?)$/)
|
170
|
-
commands = [res['cmd']]
|
171
|
-
commands.concat(res['alias'].split(/, /).delete_if(&:empty?)) if res['alias']
|
172
|
-
|
173
|
-
{
|
174
|
-
commands: commands,
|
175
|
-
description: res['desc'].short_desc
|
176
|
-
}
|
177
|
-
end
|
178
|
-
|
179
|
-
def parse_commands(commands)
|
180
|
-
commands.map { |cmd| parse_command(cmd) }
|
181
|
-
end
|
182
|
-
|
183
143
|
def generate_subcommand_completions
|
184
144
|
out = []
|
185
|
-
@commands.
|
186
|
-
|
145
|
+
@commands.each do |cmd|
|
146
|
+
desc = Shellwords.escape(cmd[:description])
|
147
|
+
cmds = cmd[:commands].join(' ')
|
148
|
+
out << "complete -xc doing -n '__fish_doing_needs_command' -a '#{cmds}' -d #{desc}"
|
187
149
|
end
|
188
150
|
|
189
151
|
out.join("\n")
|
@@ -203,14 +165,14 @@ module Doing
|
|
203
165
|
|
204
166
|
@commands.each_with_index do |cmd, i|
|
205
167
|
@bar.advance(status: cmd[:commands].first)
|
206
|
-
data = get_help_sections(cmd[:commands].first)
|
168
|
+
data = Completion.get_help_sections(cmd[:commands].first)
|
207
169
|
|
208
170
|
if data[:synopsis].join(' ').strip.split(/ /).last =~ /(path|file)/i
|
209
171
|
out << "complete -c doing -F -n '__fish_doing_using_command #{cmd[:commands].join(" ")}'"
|
210
172
|
end
|
211
173
|
|
212
174
|
if data[:command_options]
|
213
|
-
parse_options(data[:command_options]).each do |option|
|
175
|
+
Completion.parse_options(data[:command_options]).each do |option|
|
214
176
|
next if option.nil?
|
215
177
|
|
216
178
|
arg = option[:arg] ? '-r' : ''
|
@@ -221,7 +183,7 @@ module Doing
|
|
221
183
|
need_export.concat(cmd[:commands]) if option[:long] == 'output'
|
222
184
|
need_bool.concat(cmd[:commands]) if option[:long] == 'bool'
|
223
185
|
need_case.concat(cmd[:commands]) if option[:long] == 'case'
|
224
|
-
|
186
|
+
need_sort.concat(cmd[:commands]) if option[:long] == 'sort'
|
225
187
|
need_tag_sort.concat(cmd[:commands]) if option[:long] == 'tag_sort'
|
226
188
|
need_tag_order.concat(cmd[:commands]) if option[:long] == 'tag_order'
|
227
189
|
need_age.concat(cmd[:commands]) if option[:long] == 'age'
|
@@ -267,11 +229,12 @@ module Doing
|
|
267
229
|
end
|
268
230
|
|
269
231
|
def initialize
|
270
|
-
data = get_help_sections
|
271
|
-
@global_options = parse_options(data[:global_options])
|
272
|
-
@commands = parse_commands(data[:commands])
|
273
|
-
@bar = TTY::ProgressBar.new("\033[0;0;33mGenerating Fish completions: \033[0;35;40m[:bar] :status\033[0m", total: @commands.count, bar_format: :
|
274
|
-
|
232
|
+
data = Completion.get_help_sections
|
233
|
+
@global_options = Completion.parse_options(data[:global_options])
|
234
|
+
@commands = Completion.parse_commands(data[:commands])
|
235
|
+
@bar = TTY::ProgressBar.new("\033[0;0;33mGenerating Fish completions: \033[0;35;40m[:bar] :status\033[0m", total: @commands.count + 1, bar_format: :square, hide_cursor: true, status: 'processing subcommands')
|
236
|
+
width = TTY::Screen.columns - 45
|
237
|
+
@bar.resize(width)
|
275
238
|
end
|
276
239
|
|
277
240
|
def generate_completions
|
@@ -280,6 +243,7 @@ module Doing
|
|
280
243
|
out << generate_helpers
|
281
244
|
out << generate_subcommand_completions
|
282
245
|
out << generate_subcommand_option_completions
|
246
|
+
@bar.advance(status: '✅')
|
283
247
|
@bar.finish
|
284
248
|
out.join("\n")
|
285
249
|
end
|