doing 2.1.89 → 2.1.90
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/.irbrc +2 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +251 -0
- data/CHANGELOG.md +22 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +1 -1
- data/Rakefile +5 -3
- data/bin/commands/changes.rb +3 -1
- data/bin/commands/choose.rb +2 -0
- data/bin/commands/colors.rb +5 -3
- data/bin/commands/commands_accepting.rb +3 -3
- data/bin/commands/completion.rb +2 -1
- data/bin/commands/config.rb +8 -6
- data/bin/commands/done.rb +19 -12
- data/bin/commands/finish.rb +4 -2
- data/bin/commands/grep.rb +9 -5
- data/bin/commands/import.rb +14 -11
- data/bin/commands/install_fzf.rb +4 -2
- data/bin/commands/last.rb +31 -27
- data/bin/commands/meanwhile.rb +6 -2
- data/bin/commands/note.rb +6 -3
- data/bin/commands/now.rb +2 -0
- data/bin/commands/open.rb +6 -1
- data/bin/commands/plugins.rb +2 -0
- data/bin/commands/recent.rb +47 -33
- data/bin/commands/reset.rb +7 -3
- data/bin/commands/rotate.rb +6 -3
- data/bin/commands/sections.rb +3 -3
- data/bin/commands/select.rb +2 -0
- data/bin/commands/show.rb +24 -20
- data/bin/commands/since.rb +10 -3
- data/bin/commands/tag.rb +18 -16
- data/bin/commands/tag_dir.rb +5 -2
- data/bin/commands/tags.rb +17 -17
- data/bin/commands/template.rb +8 -2
- data/bin/commands/today.rb +10 -2
- data/bin/commands/undo.rb +2 -0
- data/bin/commands/update.rb +9 -7
- data/bin/commands/view.rb +11 -8
- data/bin/commands/views.rb +2 -0
- data/bin/commands/yesterday.rb +6 -1
- data/bin/doing +54 -57
- 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/ArrayCleanup.html +3 -3
- data/docs/doc/Doing/ArrayNestedHash.html +3 -3
- data/docs/doc/Doing/ArrayTags.html +9 -9
- data/docs/doc/Doing/ByDayExport.html +3 -3
- data/docs/doc/Doing/CSVExport.html +4 -4
- data/docs/doc/Doing/CalendarImport.html +4 -4
- data/docs/doc/Doing/Change.html +3 -3
- data/docs/doc/Doing/Changes.html +3 -3
- data/docs/doc/Doing/ChronifyArray.html +3 -3
- data/docs/doc/Doing/ChronifyNumeric.html +3 -3
- data/docs/doc/Doing/ChronifyString.html +6 -6
- data/docs/doc/Doing/Color.html +88 -47
- data/docs/doc/Doing/Completion/BashCompletions.html +3 -3
- data/docs/doc/Doing/Completion/FigCompletions.html +3 -3
- data/docs/doc/Doing/Completion/FishCompletions.html +3 -3
- data/docs/doc/Doing/Completion/StringUtils.html +3 -3
- data/docs/doc/Doing/Completion/ZshCompletions.html +3 -3
- data/docs/doc/Doing/Completion.html +5 -5
- data/docs/doc/Doing/Configuration.html +6 -6
- data/docs/doc/Doing/DayOneRenderer.html +3 -3
- data/docs/doc/Doing/DayoneExport.html +4 -4
- data/docs/doc/Doing/DoingExport.html +5 -5
- data/docs/doc/Doing/DoingImport.html +4 -4
- data/docs/doc/Doing/Entry.html +3 -3
- 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/HistoryLimitError.html +3 -3
- data/docs/doc/Doing/Errors/InvalidPlugin.html +3 -3
- data/docs/doc/Doing/Errors/MissingBackupFile.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/HTMLExport.html +4 -4
- data/docs/doc/Doing/Hooks.html +3 -16
- data/docs/doc/Doing/Item.html +4 -4
- data/docs/doc/Doing/ItemDates.html +3 -3
- data/docs/doc/Doing/ItemQuery.html +3 -3
- data/docs/doc/Doing/ItemState.html +3 -3
- data/docs/doc/Doing/ItemTags.html +3 -3
- data/docs/doc/Doing/Items.html +3 -3
- data/docs/doc/Doing/JSONExport.html +4 -4
- data/docs/doc/Doing/JSONImport.html +4 -4
- data/docs/doc/Doing/Logger.html +183 -3
- data/docs/doc/Doing/MarkdownExport.html +4 -4
- data/docs/doc/Doing/Note.html +3 -3
- data/docs/doc/Doing/Pager.html +54 -58
- data/docs/doc/Doing/Plugins.html +3 -3
- data/docs/doc/Doing/Prompt.html +4 -4
- data/docs/doc/Doing/PromptChoose.html +3 -3
- data/docs/doc/Doing/PromptFZF.html +3 -3
- data/docs/doc/Doing/PromptInput.html +3 -3
- data/docs/doc/Doing/PromptSTD.html +3 -3
- data/docs/doc/Doing/PromptYN.html +3 -3
- data/docs/doc/Doing/Section.html +3 -3
- data/docs/doc/Doing/StringHighlight.html +3 -3
- data/docs/doc/Doing/StringNormalize.html +3 -3
- data/docs/doc/Doing/StringQuery.html +4 -4
- data/docs/doc/Doing/StringTags.html +3 -3
- data/docs/doc/Doing/StringTransform.html +3 -3
- data/docs/doc/Doing/StringTruncate.html +3 -3
- data/docs/doc/Doing/StringURL.html +3 -3
- data/docs/doc/Doing/SymbolNormalize.html +5 -5
- data/docs/doc/Doing/TaskPaperExport.html +4 -4
- data/docs/doc/Doing/TemplateExport.html +5 -5
- data/docs/doc/Doing/TemplateString.html +7 -7
- data/docs/doc/Doing/TimingImport.html +4 -4
- data/docs/doc/Doing/Types.html +3 -3
- data/docs/doc/Doing/Util/Backup.html +4 -17
- data/docs/doc/Doing/Util.html +56 -61
- data/docs/doc/Doing/Version.html +3 -3
- data/docs/doc/Doing/WWID.html +6 -4
- data/docs/doc/Doing.html +4 -4
- data/docs/doc/FalseClass.html +3 -3
- data/docs/doc/GLI/Commands/Help.html +5 -5
- 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 +4 -4
- data/docs/doc/Numeric.html +3 -3
- data/docs/doc/Object.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 +51 -5
- data/docs/doc/Symbol.html +3 -3
- data/docs/doc/Time.html +3 -3
- data/docs/doc/TrueClass.html +3 -3
- data/docs/doc/_index.html +4 -4
- data/docs/doc/class_list.html +6 -3
- data/docs/doc/css/full_list.css +3 -3
- data/docs/doc/css/style.css +6 -0
- data/docs/doc/file.README.html +3 -3
- data/docs/doc/file_list.html +5 -2
- data/docs/doc/frames.html +1 -1
- data/docs/doc/index.html +3 -3
- data/docs/doc/js/app.js +294 -264
- data/docs/doc/js/full_list.js +30 -4
- data/docs/doc/method_list.html +443 -392
- data/docs/doc/top-level-namespace.html +3 -3
- data/doing.gemspec +2 -0
- data/doing.rdoc +1 -1
- data/example_plugin.rb +1 -4
- data/lib/doing/add_options.rb +2 -2
- data/lib/doing/array/cleanup.rb +2 -0
- data/lib/doing/array/nested_hash.rb +2 -0
- data/lib/doing/boolean_term_parser.rb +3 -3
- data/lib/doing/changelog/changes.rb +4 -5
- data/lib/doing/changelog/version.rb +8 -11
- data/lib/doing/chronify/array.rb +4 -4
- data/lib/doing/chronify/string.rb +5 -4
- data/lib/doing/cli_status.rb +7 -2
- data/lib/doing/colors.rb +93 -51
- data/lib/doing/completion/bash_completion.rb +36 -39
- data/lib/doing/completion/completion_string.rb +2 -1
- data/lib/doing/completion/fig_completion.rb +33 -33
- data/lib/doing/completion/fish_completion.rb +22 -23
- data/lib/doing/completion/zsh_completion.rb +5 -5
- data/lib/doing/completion.rb +7 -4
- data/lib/doing/configuration.rb +21 -13
- data/lib/doing/errors.rb +1 -4
- data/lib/doing/good.rb +1 -1
- data/lib/doing/hash.rb +4 -4
- data/lib/doing/help_monkey_patch.rb +1 -1
- data/lib/doing/hooks.rb +6 -2
- data/lib/doing/item/dates.rb +3 -1
- data/lib/doing/item/query.rb +10 -10
- data/lib/doing/item/state.rb +2 -0
- data/lib/doing/logger.rb +113 -45
- data/lib/doing/markdown_document_listener.rb +25 -25
- data/lib/doing/normalize.rb +1 -1
- data/lib/doing/pager.rb +73 -29
- data/lib/doing/plugin_manager.rb +4 -5
- data/lib/doing/plugins/export/byday.rb +1 -1
- data/lib/doing/plugins/export/dayone_export.rb +28 -27
- data/lib/doing/plugins/export/doing_export.rb +1 -1
- data/lib/doing/plugins/export/html_export.rb +3 -3
- data/lib/doing/plugins/export/json_export.rb +4 -5
- data/lib/doing/plugins/export/markdown_export.rb +10 -2
- data/lib/doing/plugins/export/taskpaper_export.rb +1 -0
- data/lib/doing/plugins/export/template_export.rb +110 -107
- data/lib/doing/plugins/import/calendar_import.rb +1 -1
- data/lib/doing/plugins/import/doing_import.rb +2 -2
- data/lib/doing/plugins/import/timing_import.rb +3 -3
- data/lib/doing/prompt/choose.rb +5 -6
- data/lib/doing/prompt/fzf.rb +3 -2
- data/lib/doing/prompt/input.rb +7 -6
- data/lib/doing/prompt/yn.rb +9 -11
- data/lib/doing/string/tags.rb +7 -4
- data/lib/doing/string/transform.rb +15 -10
- data/lib/doing/string/truncate.rb +1 -0
- data/lib/doing/string/url.rb +1 -1
- data/lib/doing/template_string.rb +13 -9
- data/lib/doing/time.rb +4 -2
- data/lib/doing/util.rb +12 -11
- data/lib/doing/util_backup.rb +29 -26
- data/lib/doing/version.rb +3 -1
- data/lib/doing/wwid/display.rb +182 -151
- data/lib/doing/wwid/editor.rb +13 -12
- data/lib/doing/wwid/filetools.rb +13 -11
- data/lib/doing/wwid/filter.rb +41 -40
- data/lib/doing/wwid/guess.rb +6 -8
- data/lib/doing/wwid/interactive.rb +9 -9
- data/lib/doing/wwid/modify.rb +53 -53
- data/lib/doing/wwid/timers.rb +4 -5
- data/lib/doing/wwid/wwid.rb +0 -0
- data/lib/doing/wwid/wwidutil.rb +8 -10
- data/lib/examples/commands/wiki.rb +2 -0
- data/lib/examples/plugins/capture_thing_import.rb +1 -1
- data/lib/examples/plugins/say_export.rb +1 -2
- data/lib/examples/plugins/wiki_export/wiki_export.rb +3 -4
- data/lib/helpers/fzf/test/test_go.rb +5 -5
- data/lib/helpers/threaded_tests.rb +20 -20
- data/lib/helpers/threaded_tests_string.rb +2 -0
- data/rdoc_to_mmd.rb +5 -4
- data/rdocfixer.rb +1 -2
- data/scripts/deploy.rb +3 -4
- data/scripts/generate_bash_completions.rb +40 -43
- data/scripts/generate_fish_completions.rb +17 -15
- data/scripts/generate_zsh_completions.rb +9 -7
- data/scripts/setting_replace.rb +1 -0
- data/scripts/sort_commands.rb +4 -2
- data/yard_templates/default/method_details/setup.rb +3 -1
- metadata +3 -1
data/bin/commands/last.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# @@last
|
|
2
4
|
desc 'Show the last entry, optionally edit'
|
|
3
5
|
long_desc 'Shows the last entry. Using --search and --tag filters, you can view/edit the last entry matching a filter,
|
|
@@ -6,10 +8,12 @@ command :last do |c|
|
|
|
6
8
|
c.example 'doing last', desc: 'Show the most recent entry in all sections'
|
|
7
9
|
c.example 'doing last -s Later', desc: 'Show the most recent entry in the Later section'
|
|
8
10
|
c.example 'doing last --tag project1,work --bool AND', desc: 'Show most recent entry tagged @project1 and @work'
|
|
9
|
-
c.example 'doing last --search "side hustle"',
|
|
11
|
+
c.example 'doing last --search "side hustle"',
|
|
12
|
+
desc: 'Show most recent entry containing "side hustle" (fuzzy matching)'
|
|
10
13
|
c.example 'doing last --search "\'side hustle"', desc: 'Show most recent entry containing "side hustle" (exact match)'
|
|
11
14
|
c.example 'doing last --edit', desc: 'Open the most recent entry in an editor for modifications'
|
|
12
|
-
c.example 'doing last --search "\'side hustle" --edit',
|
|
15
|
+
c.example 'doing last --search "\'side hustle" --edit',
|
|
16
|
+
desc: 'Open most recent entry containing "side hustle" (exact match) in editor'
|
|
13
17
|
|
|
14
18
|
c.desc 'Specify a section'
|
|
15
19
|
c.arg_name 'NAME'
|
|
@@ -18,10 +22,10 @@ command :last do |c|
|
|
|
18
22
|
c.desc "Edit entry with #{Doing::Util.default_editor}"
|
|
19
23
|
c.switch %i[e editor], negatable: false, default_value: false
|
|
20
24
|
|
|
21
|
-
c.desc
|
|
25
|
+
c.desc 'Delete the last entry'
|
|
22
26
|
c.switch %i[d delete], negatable: false, default_value: false
|
|
23
27
|
|
|
24
|
-
c.desc
|
|
28
|
+
c.desc 'Highlight search matches in output. Only affects command line output'
|
|
25
29
|
c.switch %i[h hilite], default_value: Doing.settings.dig('search', 'highlight')
|
|
26
30
|
|
|
27
31
|
c.desc 'Show elapsed time if entry is not tagged @done'
|
|
@@ -32,7 +36,7 @@ command :last do |c|
|
|
|
32
36
|
add_options(:tag_filter, c)
|
|
33
37
|
add_options(:save, c)
|
|
34
38
|
|
|
35
|
-
c.action do |
|
|
39
|
+
c.action do |_global_options, options, _args|
|
|
36
40
|
options[:fuzzy] = false
|
|
37
41
|
raise InvalidArgument, '--tag and --search can not be used together' if options[:tag] && options[:search]
|
|
38
42
|
|
|
@@ -42,34 +46,34 @@ command :last do |c|
|
|
|
42
46
|
|
|
43
47
|
if options[:editor]
|
|
44
48
|
@wwid.edit_last(section: options[:section],
|
|
45
|
-
|
|
46
|
-
search: options[:search],
|
|
47
|
-
fuzzy: options[:fuzzy],
|
|
48
|
-
case: options[:case],
|
|
49
|
-
tag: options[:tag],
|
|
50
|
-
tag_bool: options[:bool],
|
|
51
|
-
not: options[:not],
|
|
52
|
-
val: options[:val],
|
|
53
|
-
bool: options[:bool]
|
|
54
|
-
})
|
|
55
|
-
else
|
|
56
|
-
last = @wwid.last(times: true, section: options[:section],
|
|
57
|
-
options: {
|
|
58
|
-
config_template: options[:config_template],
|
|
59
|
-
template: options[:template],
|
|
60
|
-
duration: options[:duration],
|
|
49
|
+
options: {
|
|
61
50
|
search: options[:search],
|
|
62
51
|
fuzzy: options[:fuzzy],
|
|
63
52
|
case: options[:case],
|
|
64
|
-
hilite: options[:hilite],
|
|
65
|
-
negate: options[:not],
|
|
66
|
-
output: options[:output],
|
|
67
53
|
tag: options[:tag],
|
|
68
54
|
tag_bool: options[:bool],
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
55
|
+
not: options[:not],
|
|
56
|
+
val: options[:val],
|
|
57
|
+
bool: options[:bool]
|
|
72
58
|
})
|
|
59
|
+
else
|
|
60
|
+
last = @wwid.last(times: true, section: options[:section],
|
|
61
|
+
options: {
|
|
62
|
+
config_template: options[:config_template],
|
|
63
|
+
template: options[:template],
|
|
64
|
+
duration: options[:duration],
|
|
65
|
+
search: options[:search],
|
|
66
|
+
fuzzy: options[:fuzzy],
|
|
67
|
+
case: options[:case],
|
|
68
|
+
hilite: options[:hilite],
|
|
69
|
+
negate: options[:not],
|
|
70
|
+
output: options[:output],
|
|
71
|
+
tag: options[:tag],
|
|
72
|
+
tag_bool: options[:bool],
|
|
73
|
+
delete: options[:delete],
|
|
74
|
+
bool: options[:bool],
|
|
75
|
+
val: options[:val]
|
|
76
|
+
})
|
|
73
77
|
Doing::Pager.page last.strip if last
|
|
74
78
|
Doing.config.save_view(options.to_view, options[:save].downcase) if options[:save]
|
|
75
79
|
end
|
data/bin/commands/meanwhile.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# @@meanwhile
|
|
2
4
|
desc 'Finish any running @meanwhile tasks and optionally create a new one'
|
|
3
5
|
long_desc 'The @meanwhile tag allows you to have long-running entries that encompass smaller entries.
|
|
@@ -6,10 +8,12 @@ big project` to start a @meanwhile entry, add other entries as you work on the p
|
|
|
6
8
|
itself to mark the entry as @done.'
|
|
7
9
|
arg_name 'ENTRY', optional: true
|
|
8
10
|
command :meanwhile do |c|
|
|
9
|
-
c.example 'doing meanwhile "Long task that will have others after it before it\'s done"',
|
|
11
|
+
c.example 'doing meanwhile "Long task that will have others after it before it\'s done"',
|
|
12
|
+
desc: 'Add a new long-running entry, completing any current @meanwhile entry'
|
|
10
13
|
c.example 'doing meanwhile', desc: 'Finish any open @meanwhile entry'
|
|
11
14
|
c.example 'doing meanwhile --archive', desc: 'Finish any open @meanwhile entry and archive it'
|
|
12
|
-
c.example 'doing meanwhile --back 2h "Something I\'ve been working on for a while',
|
|
15
|
+
c.example 'doing meanwhile --back 2h "Something I\'ve been working on for a while',
|
|
16
|
+
desc: 'Add a @meanwhile entry with a start date 2 hours ago'
|
|
13
17
|
|
|
14
18
|
c.desc 'Section'
|
|
15
19
|
c.arg_name 'NAME'
|
data/bin/commands/note.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# @@note
|
|
2
4
|
desc 'Add a note to the last entry'
|
|
3
5
|
long_desc %(
|
|
@@ -12,7 +14,8 @@ command :note do |c|
|
|
|
12
14
|
c.example 'doing note', desc: 'Open the last entry in $EDITOR to append a note'
|
|
13
15
|
c.example 'doing note "Just a quick annotation"', desc: 'Add a quick note to the last entry'
|
|
14
16
|
c.example 'doing note --tag done "Keeping it real or something"', desc: 'Add a note to the last item tagged @done'
|
|
15
|
-
c.example 'doing note --search "late night" -e',
|
|
17
|
+
c.example 'doing note --search "late night" -e',
|
|
18
|
+
desc: 'Open $EDITOR to add a note to the last item containing "late night" (fuzzy matched)'
|
|
16
19
|
|
|
17
20
|
c.desc 'Section'
|
|
18
21
|
c.arg_name 'NAME'
|
|
@@ -71,8 +74,8 @@ command :note do |c|
|
|
|
71
74
|
end
|
|
72
75
|
|
|
73
76
|
if (new_note.empty? && !options[:remove]) || options[:ask]
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
warn last_note if last_note.good?
|
|
78
|
+
warn new_note if new_note.good?
|
|
76
79
|
new_note.add(Doing::Prompt.read_lines(prompt: 'Add a note'))
|
|
77
80
|
end
|
|
78
81
|
|
data/bin/commands/now.rb
CHANGED
data/bin/commands/open.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# @@open
|
|
2
4
|
desc 'Open the "doing" file in an editor'
|
|
3
5
|
long_desc "`doing open` defaults to using the editors.doing_file setting
|
|
@@ -25,7 +27,10 @@ command :open do |c|
|
|
|
25
27
|
end
|
|
26
28
|
|
|
27
29
|
if options[:editor]
|
|
28
|
-
|
|
30
|
+
unless Doing::Util.exec_available(options[:editor].split(/ /).first)
|
|
31
|
+
raise MissingEditor,
|
|
32
|
+
"Editor #{options[:editor]} not found"
|
|
33
|
+
end
|
|
29
34
|
|
|
30
35
|
editor = TTY::Which.which(options[:editor])
|
|
31
36
|
system %(#{editor} "#{File.expand_path(@wwid.doing_file)}")
|
data/bin/commands/plugins.rb
CHANGED
data/bin/commands/recent.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# @@recent
|
|
2
4
|
desc 'List recent entries'
|
|
3
5
|
default_value 10
|
|
@@ -21,39 +23,51 @@ command :recent do |c|
|
|
|
21
23
|
add_options(:save, c)
|
|
22
24
|
|
|
23
25
|
c.action do |global_options, options, args|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
26
|
+
Doing.logger.measure(:recent_command) do
|
|
27
|
+
section = @wwid.guess_section(options[:section]) || options[:section].cap_first
|
|
28
|
+
|
|
29
|
+
unless global_options[:version]
|
|
30
|
+
count = nil
|
|
31
|
+
opts = nil
|
|
32
|
+
|
|
33
|
+
Doing.logger.measure(:recent_config) do
|
|
34
|
+
config_count = if Doing.setting('templates.recent.count')
|
|
35
|
+
Doing.setting('templates.recent.count').to_i
|
|
36
|
+
else
|
|
37
|
+
10
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
count = args.empty? ? config_count : args[0].to_i
|
|
41
|
+
|
|
42
|
+
options[:times] = true if options[:totals]
|
|
43
|
+
options[:sort_tags] = options[:tag_sort]
|
|
44
|
+
|
|
45
|
+
template = Doing.setting('templates.recent').deep_merge(Doing.setting('templates.default'))
|
|
46
|
+
tags_color = template.key?('tags_color') ? template['tags_color'] : nil
|
|
47
|
+
|
|
48
|
+
opts = {
|
|
49
|
+
config_template: options[:config_template],
|
|
50
|
+
duration: options[:duration],
|
|
51
|
+
interactive: options[:interactive],
|
|
52
|
+
output: options[:output],
|
|
53
|
+
sort_tags: options[:sort_tags],
|
|
54
|
+
tags_color: tags_color,
|
|
55
|
+
template: options[:template],
|
|
56
|
+
times: options[:times],
|
|
57
|
+
totals: options[:totals]
|
|
58
|
+
}
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
Doing.logger.measure(:recent_pager) do
|
|
62
|
+
Doing::Pager.page @wwid.recent(count, section.cap_first, opts)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
Doing.logger.measure(:recent_save) do
|
|
66
|
+
opts[:count] = count
|
|
67
|
+
opts[:title] = options[:title]
|
|
68
|
+
Doing.config.save_view(opts.to_view, options[:save].downcase) if options[:save]
|
|
69
|
+
end
|
|
70
|
+
end
|
|
57
71
|
end
|
|
58
72
|
end
|
|
59
73
|
end
|
data/bin/commands/reset.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# @@reset @@begin
|
|
2
4
|
desc 'Reset the start time of an entry'
|
|
3
5
|
long_desc 'Update the start time of the last entry or the last entry matching a tag/search filter.
|
|
@@ -6,9 +8,11 @@ If a date string is provided as an argument, the start time will be set to the p
|
|
|
6
8
|
arg_name 'DATE_STRING', optional: true
|
|
7
9
|
command %i[reset begin] do |c|
|
|
8
10
|
c.example 'doing reset', desc: 'Reset the start time of the last entry to the current time'
|
|
9
|
-
c.example 'doing reset --tag project1',
|
|
11
|
+
c.example 'doing reset --tag project1',
|
|
12
|
+
desc: 'Reset the start time of the most recent entry tagged @project1 to the current time'
|
|
10
13
|
c.example 'doing reset 3pm', desc: 'Reset the start time of the last entry to 3pm of the current day'
|
|
11
|
-
c.example 'doing begin --tag todo --resume',
|
|
14
|
+
c.example 'doing begin --tag todo --resume',
|
|
15
|
+
desc: 'alias for reset. Updates the last @todo entry to the current time, removing @done tag.'
|
|
12
16
|
|
|
13
17
|
c.desc 'Limit search to section'
|
|
14
18
|
c.arg_name 'NAME'
|
|
@@ -37,7 +41,7 @@ command %i[reset begin] do |c|
|
|
|
37
41
|
add_options(:search, c)
|
|
38
42
|
add_options(:tag_filter, c)
|
|
39
43
|
|
|
40
|
-
c.action do |
|
|
44
|
+
c.action do |_global_options, options, args|
|
|
41
45
|
if args.count.positive?
|
|
42
46
|
reset_date = args.join(' ').chronify(guess: :begin)
|
|
43
47
|
raise InvalidArgument, 'Invalid date string' unless reset_date
|
data/bin/commands/rotate.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# @@rotate
|
|
2
4
|
desc 'Move entries to archive file'
|
|
3
5
|
long_desc 'As your doing file grows, commands can get slow. Given that your historical data (and your archive section)
|
|
@@ -5,8 +7,10 @@ probably aren\'t providing any useful insights a year later, use this command to
|
|
|
5
7
|
file. You\'ll still have access to all historical data, but it won\'t be slowing down daily operation.'
|
|
6
8
|
command :rotate do |c|
|
|
7
9
|
c.example 'doing rotate', desc: 'Move all entries in doing file to a dated secondary file'
|
|
8
|
-
c.example 'doing rotate --section Archive --keep 10',
|
|
9
|
-
|
|
10
|
+
c.example 'doing rotate --section Archive --keep 10',
|
|
11
|
+
desc: 'Move entries in the Archive section to a secondary file, keeping the most recent 10 entries'
|
|
12
|
+
c.example 'doing rotate --tag project1,done --bool AND',
|
|
13
|
+
desc: 'Move entries tagged @project1 and @done to a secondary file'
|
|
10
14
|
|
|
11
15
|
c.desc 'How many items to keep in each section (most recent)'
|
|
12
16
|
c.arg_name 'X'
|
|
@@ -56,4 +60,3 @@ end
|
|
|
56
60
|
# @wwid.write(@wwid.doing_file)
|
|
57
61
|
# end
|
|
58
62
|
# end
|
|
59
|
-
|
data/bin/commands/sections.rb
CHANGED
|
@@ -51,10 +51,11 @@ command :sections do |c|
|
|
|
51
51
|
items = @wwid.content.in_section(section)
|
|
52
52
|
|
|
53
53
|
if items.count.positive?
|
|
54
|
-
res = Doing::Prompt.yn("#{options[:archive] ? 'Archive' : 'Delete'} #{items.count} entries from #{section}",
|
|
54
|
+
res = Doing::Prompt.yn("#{options[:archive] ? 'Archive' : 'Delete'} #{items.count} entries from #{section}",
|
|
55
|
+
default_response: 'n')
|
|
55
56
|
|
|
56
57
|
if options[:archive] && res
|
|
57
|
-
@wwid.archive(section, {keep: 0})
|
|
58
|
+
@wwid.archive(section, { keep: 0 })
|
|
58
59
|
elsif res
|
|
59
60
|
items.each { |item| @wwid.content.delete_item(item) }
|
|
60
61
|
end
|
|
@@ -83,4 +84,3 @@ command :add_section do |c|
|
|
|
83
84
|
action.call(g, o, a)
|
|
84
85
|
end
|
|
85
86
|
end
|
|
86
|
-
|
data/bin/commands/select.rb
CHANGED
data/bin/commands/show.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# @@show
|
|
2
4
|
desc 'List all entries'
|
|
3
5
|
long_desc %(
|
|
@@ -15,14 +17,16 @@ command :show do |c|
|
|
|
15
17
|
c.example 'doing show Later @doing', desc: 'Show entries from the Later section tagged @doing'
|
|
16
18
|
c.example 'doing show @oracle @writing --bool and', desc: 'Show entries tagged both @oracle and @writing'
|
|
17
19
|
c.example 'doing show Currently @devo --bool not', desc: 'Show entries in Currently NOT tagged @devo'
|
|
18
|
-
c.example 'doing show Ideas @doing --from "mon to fri"',
|
|
19
|
-
|
|
20
|
+
c.example 'doing show Ideas @doing --from "mon to fri"',
|
|
21
|
+
desc: 'Show entries tagged @doing from the Ideas section added between monday and friday of the current week.'
|
|
22
|
+
c.example 'doing show --interactive Later @doing',
|
|
23
|
+
desc: 'Create a menu from entries from the Later section tagged @doing to perform batch actions'
|
|
20
24
|
|
|
21
25
|
c.desc 'Max count to show'
|
|
22
26
|
c.arg_name 'MAX'
|
|
23
27
|
c.flag %i[c count], default_value: 0, must_match: /^\d+$/, type: Integer
|
|
24
28
|
|
|
25
|
-
c.desc
|
|
29
|
+
c.desc 'Highlight search matches in output. Only affects command line output'
|
|
26
30
|
c.switch %i[h hilite], default_value: Doing.settings.dig('search', 'highlight')
|
|
27
31
|
|
|
28
32
|
c.desc "Edit matching entries with #{Doing::Util.default_editor}"
|
|
@@ -111,11 +115,11 @@ command :show do |c|
|
|
|
111
115
|
options[:times] = true if options[:totals]
|
|
112
116
|
|
|
113
117
|
template = Doing.setting(['templates', options[:config_template]]).deep_merge({
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
'wrap_width' => Doing.setting('wrap_width') || 0,
|
|
119
|
+
'date_format' => Doing.setting('default_date_format'),
|
|
120
|
+
'order' => Doing.setting('order')&.normalize_order || :asc,
|
|
121
|
+
'tags_color' => Doing.setting('tags_color')
|
|
122
|
+
})
|
|
119
123
|
|
|
120
124
|
if options[:search]
|
|
121
125
|
search = options[:search]
|
|
@@ -138,19 +142,19 @@ command :show do |c|
|
|
|
138
142
|
items = @wwid.filter_items([], opt: options)
|
|
139
143
|
|
|
140
144
|
if options[:menu]
|
|
141
|
-
Doing.logger.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
145
|
+
Doing.logger.measure(:menu) do
|
|
146
|
+
tag = @wwid.choose_tag(section, items: items, include_all: true)
|
|
147
|
+
raise UserCancelled unless tag
|
|
148
|
+
|
|
149
|
+
tags = tag.split(/ +/).map { |t| t.strip.sub(/^@?/, '') } if tag =~ /^@/
|
|
150
|
+
if tags.good?
|
|
151
|
+
tag_filter = {
|
|
152
|
+
'tags' => tags,
|
|
153
|
+
'bool' => options[:bool]
|
|
154
|
+
}
|
|
155
|
+
options[:tag_filter] = tag_filter
|
|
156
|
+
end
|
|
152
157
|
end
|
|
153
|
-
Doing.logger.benchmark(:menu, :finish)
|
|
154
158
|
end
|
|
155
159
|
|
|
156
160
|
options[:age] ||= :newest
|
data/bin/commands/since.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# @since
|
|
2
4
|
desc 'List entries since a date'
|
|
3
5
|
long_desc %(Date argument can be natural language and are always interpreted as being in the past. "thursday" would be interpreted as "last thursday,"
|
|
@@ -5,7 +7,8 @@ and "2d" would be interpreted as "two days ago.")
|
|
|
5
7
|
arg_name 'DATE_STRING'
|
|
6
8
|
command :since do |c|
|
|
7
9
|
c.example 'doing since 7/30', desc: 'List all entries created since 12am on 7/30 of the current year'
|
|
8
|
-
c.example 'doing since "monday 3pm" --output json',
|
|
10
|
+
c.example 'doing since "monday 3pm" --output json',
|
|
11
|
+
desc: 'Show entries since 3pm on Monday of the current week, output in JSON format'
|
|
9
12
|
|
|
10
13
|
c.desc 'Section'
|
|
11
14
|
c.arg_name 'NAME'
|
|
@@ -17,7 +20,10 @@ command :since do |c|
|
|
|
17
20
|
add_options(:search, c)
|
|
18
21
|
add_options(:save, c)
|
|
19
22
|
c.action do |_global_options, options, args|
|
|
20
|
-
|
|
23
|
+
if options[:output] && options[:output] !~ Doing::Plugins.plugin_regex(type: :export)
|
|
24
|
+
raise DoingRuntimeError,
|
|
25
|
+
%(Invalid output type "#{options[:output]}")
|
|
26
|
+
end
|
|
21
27
|
|
|
22
28
|
raise MissingArgument, 'Missing date argument' if args.empty?
|
|
23
29
|
|
|
@@ -36,7 +42,8 @@ command :since do |c|
|
|
|
36
42
|
options[:times] = true if options[:totals]
|
|
37
43
|
options[:sort_tags] = options[:tag_sort]
|
|
38
44
|
|
|
39
|
-
Doing::Pager.page @wwid.list_date([start, finish], options[:section], options[:times], options[:output],
|
|
45
|
+
Doing::Pager.page @wwid.list_date([start, finish], options[:section], options[:times], options[:output],
|
|
46
|
+
options).chomp
|
|
40
47
|
if options[:save]
|
|
41
48
|
options[:after] = Doing.original_options[:date_begin] if Doing.original_options[:date_begin].good?
|
|
42
49
|
Doing.config.save_view(options.to_view, options[:save].downcase)
|
data/bin/commands/tag.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# @@tag
|
|
2
4
|
desc 'Add tag(s) to last entry'
|
|
3
5
|
long_desc 'Add (or remove) tags from the last entry, or from multiple entries
|
|
@@ -17,9 +19,12 @@ arg_name 'TAG', :multiple
|
|
|
17
19
|
command :tag do |c|
|
|
18
20
|
c.example 'doing tag mytag', desc: 'Add @mytag to the last entry created'
|
|
19
21
|
c.example 'doing tag --remove mytag', desc: 'Remove @mytag from the last entry created'
|
|
20
|
-
c.example 'doing tag --rename "other*" --count 10 newtag',
|
|
21
|
-
|
|
22
|
-
c.example 'doing tag --
|
|
22
|
+
c.example 'doing tag --rename "other*" --count 10 newtag',
|
|
23
|
+
desc: 'Rename tags beginning with "other" (wildcard) to @newtag on the last 10 entries'
|
|
24
|
+
c.example 'doing tag --search "developing" coding',
|
|
25
|
+
desc: 'Add @coding to the last entry containing string "developing" (fuzzy matching)'
|
|
26
|
+
c.example 'doing tag --interactive --tag project1 coding',
|
|
27
|
+
desc: 'Create an interactive menu from entries tagged @project1, selection(s) will be tagged with @coding'
|
|
23
28
|
|
|
24
29
|
c.desc 'Section'
|
|
25
30
|
c.arg_name 'SECTION_NAME'
|
|
@@ -69,9 +74,7 @@ command :tag do |c|
|
|
|
69
74
|
|
|
70
75
|
section = 'All'
|
|
71
76
|
|
|
72
|
-
if options[:section]
|
|
73
|
-
section = @wwid.guess_section(options[:section]) || options[:section].cap_first
|
|
74
|
-
end
|
|
77
|
+
section = @wwid.guess_section(options[:section]) || options[:section].cap_first if options[:section]
|
|
75
78
|
|
|
76
79
|
search_tags = options[:tag].nil? ? [] : options[:tag]
|
|
77
80
|
|
|
@@ -112,16 +115,15 @@ command :tag do |c|
|
|
|
112
115
|
matches = @wwid.filter_items([], opt: options).count
|
|
113
116
|
|
|
114
117
|
if matches > 5
|
|
115
|
-
if options[:search]
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
118
|
+
section_q = if options[:search]
|
|
119
|
+
' matching your search terms'
|
|
120
|
+
elsif options[:tag]
|
|
121
|
+
' matching your tag search'
|
|
122
|
+
elsif section == 'All'
|
|
123
|
+
''
|
|
124
|
+
else
|
|
125
|
+
" in section #{section}"
|
|
126
|
+
end
|
|
125
127
|
|
|
126
128
|
question = if options[:autotag]
|
|
127
129
|
"Are you sure you want to autotag #{matches} records#{section_q}"
|
data/bin/commands/tag_dir.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# @@tag_dir
|
|
2
4
|
desc 'Set the default tags for the current directory'
|
|
3
5
|
long_desc 'Adds default_tags to a .doingrc file in the current directory. Any entry created in this directory or its
|
|
@@ -5,7 +7,8 @@ subdirectories will be tagged with the default tags. You can modify these any ti
|
|
|
5
7
|
manually editing the .doingrc file.'
|
|
6
8
|
arg_name 'TAG [TAG..]'
|
|
7
9
|
command :tag_dir do |c|
|
|
8
|
-
c.example 'doing tag_dir project1 project2',
|
|
10
|
+
c.example 'doing tag_dir project1 project2',
|
|
11
|
+
desc: 'Add @project1 and @project2 to to any entries created from the current directory'
|
|
9
12
|
c.example 'doing tag_dir --clear', desc: 'Clear the default tags for the directory'
|
|
10
13
|
|
|
11
14
|
c.desc 'Remove all default_tags from the local .doingrc'
|
|
@@ -20,7 +23,7 @@ command :tag_dir do |c|
|
|
|
20
23
|
c.action do |global, options, args|
|
|
21
24
|
if args.empty? && !options[:clear] && !options[:editor]
|
|
22
25
|
all_tags = @wwid.content.all_tags
|
|
23
|
-
|
|
26
|
+
warn Doing::Color.boldwhite('Enter tags separated by spaces, tab to complete')
|
|
24
27
|
input = Doing::Prompt.read_line(prompt: "Tags to #{options[:remove] ? 'remove' : 'add'}", completions: all_tags)
|
|
25
28
|
tags = input.split_tags
|
|
26
29
|
else
|
data/bin/commands/tags.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# @@tags
|
|
2
4
|
desc 'List all tags in the current Doing file'
|
|
3
5
|
arg_name 'MAX_COUNT', optional: true, type: Integer
|
|
@@ -27,40 +29,38 @@ command :tags do |c|
|
|
|
27
29
|
add_options(:tag_filter, c)
|
|
28
30
|
|
|
29
31
|
c.action do |_global, options, args|
|
|
30
|
-
|
|
32
|
+
@wwid.guess_section(options[:section]) || options[:section].cap_first
|
|
31
33
|
options[:count] = args.count.positive? ? args[0].to_i : 0
|
|
32
34
|
|
|
33
35
|
items = @wwid.filter_items([], opt: options)
|
|
34
36
|
|
|
35
37
|
if options[:interactive]
|
|
36
38
|
items = Doing::Prompt.choose_from_items(items, include_section: options[:section].nil?,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
menu: true,
|
|
40
|
+
header: '',
|
|
41
|
+
prompt: 'Select entries to scan > ',
|
|
42
|
+
multiple: true,
|
|
43
|
+
sort: true,
|
|
44
|
+
show_if_single: true)
|
|
43
45
|
end
|
|
44
46
|
|
|
45
47
|
# items = @wwid.content.in_section(section)
|
|
46
48
|
tags = @wwid.all_tags(items, counts: true)
|
|
47
49
|
|
|
48
|
-
if options[:sort] =~ /^n/i
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
tags = if options[:sort] =~ /^n/i
|
|
51
|
+
tags.sort_by { |tag, _count| tag }
|
|
52
|
+
else
|
|
53
|
+
tags.sort_by { |_tag, count| count }
|
|
54
|
+
end
|
|
53
55
|
|
|
54
56
|
tags.reverse! if options[:order] == :desc
|
|
55
57
|
|
|
56
58
|
if options[:counts]
|
|
57
59
|
tags.each { |t, c| puts "#{t} (#{c})" }
|
|
60
|
+
elsif options[:line]
|
|
61
|
+
puts tags.map { |t, _c| t }.to_tags.join(' ')
|
|
58
62
|
else
|
|
59
|
-
|
|
60
|
-
puts tags.map { |t, c| t }.to_tags.join(' ')
|
|
61
|
-
else
|
|
62
|
-
tags.each { |t, c| puts "#{t}" }
|
|
63
|
-
end
|
|
63
|
+
tags.each_key { |t| puts t }
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
66
|
end
|
data/bin/commands/template.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
# @@template
|
|
2
4
|
desc 'Output HTML, CSS, and Markdown (ERB) templates for customization'
|
|
3
5
|
long_desc %(
|
|
@@ -31,14 +33,18 @@ command :template do |c|
|
|
|
31
33
|
else
|
|
32
34
|
|
|
33
35
|
if args.empty?
|
|
34
|
-
type = Doing::Prompt.choose_from(Doing::Plugins.plugin_templates, sorted: false,
|
|
36
|
+
type = Doing::Prompt.choose_from(Doing::Plugins.plugin_templates, sorted: false,
|
|
37
|
+
prompt: 'Select template type > ')
|
|
35
38
|
type.sub!(/ \(.*?\)$/, '').strip!
|
|
36
39
|
options[:save] = Doing::Prompt.yn("Save to #{options[:path]}? (No outputs to STDOUT)", default_response: false)
|
|
37
40
|
else
|
|
38
41
|
type = args[0]
|
|
39
42
|
end
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
unless type
|
|
45
|
+
raise InvalidPluginType,
|
|
46
|
+
"No type specified, use `doing template [#{Doing::Plugins.plugin_templates.join('|')}]`"
|
|
47
|
+
end
|
|
42
48
|
|
|
43
49
|
if options[:save]
|
|
44
50
|
Doing::Plugins.template_for_trigger(type, save_to: options[:path])
|