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/bin/commands/open.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# @@open
|
2
2
|
desc 'Open the "doing" file in an editor'
|
3
3
|
long_desc "`doing open` defaults to using the editors.doing_file setting
|
4
|
-
in #{
|
4
|
+
in #{Doing.config.config_file} (#{Doing::Util.find_default_editor('doing_file')})."
|
5
5
|
command :open do |c|
|
6
6
|
c.example 'doing open', desc: 'Open the doing file in the default editor'
|
7
7
|
c.desc 'Open with editor command (e.g. vim, mate)'
|
data/bin/commands/recent.rb
CHANGED
@@ -12,9 +12,6 @@ command :recent do |c|
|
|
12
12
|
c.arg_name 'NAME'
|
13
13
|
c.flag %i[s section], default_value: 'All'
|
14
14
|
|
15
|
-
c.desc 'Show time intervals on @done tasks'
|
16
|
-
c.switch %i[t times], default_value: true, negatable: true
|
17
|
-
|
18
15
|
c.desc "Output using a template from configuration"
|
19
16
|
c.arg_name 'TEMPLATE_KEY'
|
20
17
|
c.flag [:config_template], type: TemplateName, default_value: 'recent'
|
@@ -23,26 +20,17 @@ command :recent do |c|
|
|
23
20
|
c.arg_name 'TEMPLATE_STRING'
|
24
21
|
c.flag [:template]
|
25
22
|
|
26
|
-
c.desc 'Show elapsed time on entries without @done tag'
|
27
|
-
c.switch [:duration]
|
28
|
-
|
29
|
-
c.desc 'Show intervals with totals at the end of output'
|
30
|
-
c.switch [:totals], default_value: false, negatable: false
|
31
|
-
|
32
|
-
c.desc 'Sort tags by (name|time)'
|
33
|
-
default = @settings['tag_sort'].normalize_tag_sort || :name
|
34
|
-
c.arg_name 'KEY'
|
35
|
-
c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
|
36
|
-
|
37
23
|
c.desc 'Select from a menu of matching entries to perform additional operations'
|
38
24
|
c.switch %i[i interactive], negatable: false, default_value: false
|
39
25
|
|
26
|
+
add_options(:time_display, c)
|
27
|
+
|
40
28
|
c.action do |global_options, options, args|
|
41
29
|
section = @wwid.guess_section(options[:section]) || options[:section].cap_first
|
42
30
|
|
43
31
|
unless global_options[:version]
|
44
|
-
if
|
45
|
-
config_count =
|
32
|
+
if Doing.setting('templates.recent.count')
|
33
|
+
config_count = Doing.setting('templates.recent.count').to_i
|
46
34
|
else
|
47
35
|
config_count = 10
|
48
36
|
end
|
@@ -56,7 +44,7 @@ command :recent do |c|
|
|
56
44
|
options[:times] = true if options[:totals]
|
57
45
|
options[:sort_tags] = options[:tag_sort]
|
58
46
|
|
59
|
-
template =
|
47
|
+
template = Doing.setting('templates.recent').deep_merge(Doing.setting('templates.default'))
|
60
48
|
tags_color = template.key?('tags_color') ? template['tags_color'] : nil
|
61
49
|
|
62
50
|
opts = {
|
data/bin/commands/rotate.rb
CHANGED
@@ -40,3 +40,20 @@ command :rotate do |c|
|
|
40
40
|
@wwid.rotate(options)
|
41
41
|
end
|
42
42
|
end
|
43
|
+
|
44
|
+
# # @@doctor
|
45
|
+
|
46
|
+
# desc 'Doing file maintenance.'
|
47
|
+
# long_desc %(Duplicate entries compressed to a single entry. This will modify the doing file.)
|
48
|
+
# command :doctor do |c|
|
49
|
+
# c.example 'doing doctor', desc: 'Clean up the Doing file, sorting and removing duplicates'
|
50
|
+
|
51
|
+
# c.desc 'Only remove duplicates in the same section'
|
52
|
+
# c.switch %i[s same_section], negatable: false, default_value: false
|
53
|
+
|
54
|
+
# c.action do |_global_options, options, _args|
|
55
|
+
# @wwid.content.dedup!(match_section: options[:same_section])
|
56
|
+
# @wwid.write(@wwid.doing_file)
|
57
|
+
# end
|
58
|
+
# end
|
59
|
+
|
data/bin/commands/sections.rb
CHANGED
@@ -1,11 +1,86 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# @@add_section
|
4
|
+
desc 'List, add, or remove sections in the Doing file'
|
3
5
|
command :sections do |c|
|
4
|
-
c.
|
5
|
-
|
6
|
+
c.default_command :list
|
7
|
+
|
8
|
+
c.example 'doing sections add Ideas', desc: 'Add a section called Ideas to the doing file'
|
9
|
+
c.example 'doing sections remove Reminders', desc: 'Remove the section Reminders'
|
10
|
+
c.example 'doing sections list', desc: 'List all sections'
|
11
|
+
|
12
|
+
c.desc 'Add a section'
|
13
|
+
c.arg_name 'SECTION_NAME'
|
14
|
+
c.command :add do |add|
|
15
|
+
add.action do |_g, _o, args|
|
16
|
+
raise InvalidArgument, "Section #{args[0]} already exists" if @wwid.sections.include?(args[0])
|
17
|
+
|
18
|
+
@wwid.content.add_section(args.join(' ').cap_first, log: true)
|
19
|
+
@wwid.write(@wwid.doing_file)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
c.desc 'List sections'
|
24
|
+
c.command :list do |list|
|
25
|
+
list.desc 'List in single column'
|
26
|
+
list.switch %i[c column], negatable: false, default_value: false
|
27
|
+
|
28
|
+
list.action do |_global_options, options, _args|
|
29
|
+
joiner = options[:column] ? "\n" : "\t"
|
30
|
+
print @wwid.content.section_titles.join(joiner)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
c.desc 'Remove a section'
|
35
|
+
c.arg_name 'SECTION_NAME'
|
36
|
+
c.command :remove do |remove|
|
37
|
+
remove.desc 'Archive entries in section before deleting. --no-archive permanently deletes section contents'
|
38
|
+
remove.switch %i[a archive], default_value: true, negatable: true
|
39
|
+
|
40
|
+
remove.action do |_g, options, args|
|
41
|
+
raise InvalidArgument, '--delete cannot be used with --archive' if options[:delete] && options[:archive]
|
42
|
+
|
43
|
+
section = args[0].cap_first
|
44
|
+
|
45
|
+
unless @wwid.sections.include?(section)
|
46
|
+
Doing.logger.log_now(:warn, 'Section:', "#{section} not found, did you mean #{guess_section(section)}?")
|
47
|
+
raise InvalidArgument, "Section #{args[0]} doesn't exist"
|
6
48
|
|
7
|
-
|
8
|
-
|
9
|
-
|
49
|
+
end
|
50
|
+
|
51
|
+
items = @wwid.content.in_section(section)
|
52
|
+
|
53
|
+
if items.count.positive?
|
54
|
+
res = Doing::Prompt.yn("#{options[:archive] ? 'Archive' : 'Delete'} #{items.count} entries from #{section}", default_response: 'n')
|
55
|
+
|
56
|
+
if options[:archive] && res
|
57
|
+
@wwid.archive(section, {keep: 0})
|
58
|
+
elsif res
|
59
|
+
items.each { |item| @wwid.content.delete_item(item) }
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
@wwid.content.delete_section(section, log: true)
|
64
|
+
|
65
|
+
@wwid.write(@wwid.doing_file)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# For backward compatibility
|
71
|
+
# @@add_section
|
72
|
+
command :add_section do |c|
|
73
|
+
c.desc 'Archive entries in section before deleting'
|
74
|
+
c.switch %i[a archive], default_value: true, negatable: true
|
75
|
+
|
76
|
+
c.desc 'Permanently delete entries in section'
|
77
|
+
c.switch %i[d delete], default_value: false
|
78
|
+
|
79
|
+
c.action do |g, o, a|
|
80
|
+
cmd = commands[:sections].commands[:add]
|
81
|
+
|
82
|
+
action = cmd.send(:get_action, nil)
|
83
|
+
action.call(g, o, a)
|
10
84
|
end
|
11
85
|
end
|
86
|
+
|
data/bin/commands/show.rb
CHANGED
@@ -27,33 +27,12 @@ command :show do |c|
|
|
27
27
|
c.flag %i[a age], default_value: :newest, type: AgeSymbol
|
28
28
|
|
29
29
|
c.desc "Highlight search matches in output. Only affects command line output"
|
30
|
-
c.switch %i[h hilite], default_value:
|
30
|
+
c.switch %i[h hilite], default_value: Doing.settings.dig('search', 'highlight')
|
31
31
|
|
32
32
|
c.desc 'Sort order (asc/desc)'
|
33
33
|
c.arg_name 'ORDER'
|
34
34
|
c.flag %i[s sort], must_match: REGEX_SORT_ORDER, default_value: :asc, type: OrderSymbol
|
35
35
|
|
36
|
-
c.desc 'Show time intervals on @done tasks'
|
37
|
-
c.switch %i[t times], default_value: true, negatable: true
|
38
|
-
|
39
|
-
c.desc 'Show elapsed time on entries without @done tag'
|
40
|
-
c.switch [:duration]
|
41
|
-
|
42
|
-
c.desc 'Show intervals with totals at the end of output'
|
43
|
-
c.switch [:totals], default_value: false, negatable: false
|
44
|
-
|
45
|
-
c.desc 'Sort tags by (name|time)'
|
46
|
-
default = @settings['tag_sort'].normalize_tag_sort || :name
|
47
|
-
c.arg_name 'KEY'
|
48
|
-
c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
|
49
|
-
|
50
|
-
c.desc 'Tag sort direction (asc|desc)'
|
51
|
-
c.arg_name 'DIRECTION'
|
52
|
-
c.flag [:tag_order], must_match: REGEX_SORT_ORDER, default_value: :asc, type: OrderSymbol
|
53
|
-
|
54
|
-
c.desc 'Only show items with recorded time intervals'
|
55
|
-
c.switch [:only_timed], default_value: false, negatable: false
|
56
|
-
|
57
36
|
c.desc "Output using a template from configuration"
|
58
37
|
c.arg_name 'TEMPLATE_KEY'
|
59
38
|
c.flag [:config_template], type: TemplateName, default_value: 'default'
|
@@ -72,6 +51,7 @@ command :show do |c|
|
|
72
51
|
c.arg_name 'FORMAT'
|
73
52
|
c.flag %i[o output]
|
74
53
|
|
54
|
+
add_options(:time_display, c)
|
75
55
|
add_options(:search, c)
|
76
56
|
add_options(:tag_filter, c)
|
77
57
|
add_options(:date_filter, c)
|
@@ -118,7 +98,7 @@ command :show do |c|
|
|
118
98
|
end
|
119
99
|
end
|
120
100
|
else
|
121
|
-
section = options[:menu] ? @wwid.choose_section(include_all: true) :
|
101
|
+
section = options[:menu] ? @wwid.choose_section(include_all: true) : Doing.setting('current_section')
|
122
102
|
section ||= 'All'
|
123
103
|
end
|
124
104
|
|
@@ -126,11 +106,11 @@ command :show do |c|
|
|
126
106
|
|
127
107
|
options[:times] = true if options[:totals]
|
128
108
|
|
129
|
-
template =
|
130
|
-
'wrap_width' =>
|
131
|
-
'date_format' =>
|
132
|
-
'order' =>
|
133
|
-
'tags_color' =>
|
109
|
+
template = Doing.setting(['templates', options[:config_template]]).deep_merge({
|
110
|
+
'wrap_width' => Doing.setting('wrap_width') || 0,
|
111
|
+
'date_format' => Doing.setting('default_date_format'),
|
112
|
+
'order' => Doing.setting('order')&.normalize_order || :asc,
|
113
|
+
'tags_color' => Doing.setting('tags_color')
|
134
114
|
})
|
135
115
|
|
136
116
|
if options[:search]
|
data/bin/commands/since.rb
CHANGED
@@ -11,20 +11,6 @@ command :since do |c|
|
|
11
11
|
c.arg_name 'NAME'
|
12
12
|
c.flag %i[s section], default_value: 'All'
|
13
13
|
|
14
|
-
c.desc 'Show time intervals on @done tasks'
|
15
|
-
c.switch %i[t times], default_value: true, negatable: true
|
16
|
-
|
17
|
-
c.desc 'Show elapsed time on entries without @done tag'
|
18
|
-
c.switch [:duration]
|
19
|
-
|
20
|
-
c.desc 'Show time totals at the end of output'
|
21
|
-
c.switch [:totals], default_value: false, negatable: false
|
22
|
-
|
23
|
-
c.desc 'Sort tags by (name|time)'
|
24
|
-
default = @settings['tag_sort'].normalize_tag_sort || :name
|
25
|
-
c.arg_name 'KEY'
|
26
|
-
c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
|
27
|
-
|
28
14
|
c.desc "Output to export format (#{Doing::Plugins.plugin_names(type: :export)})"
|
29
15
|
c.arg_name 'FORMAT'
|
30
16
|
c.flag %i[o output]
|
@@ -37,6 +23,10 @@ command :since do |c|
|
|
37
23
|
c.arg_name 'TEMPLATE_STRING'
|
38
24
|
c.flag [:template]
|
39
25
|
|
26
|
+
add_options(:time_display, c)
|
27
|
+
add_options(:tag_filter, c)
|
28
|
+
add_options(:search, c)
|
29
|
+
|
40
30
|
c.action do |_global_options, options, args|
|
41
31
|
raise DoingRuntimeError, %(Invalid output type "#{options[:output]}") if options[:output] && options[:output] !~ Doing::Plugins.plugin_regex(type: :export)
|
42
32
|
|
@@ -57,7 +47,6 @@ command :since do |c|
|
|
57
47
|
options[:times] = true if options[:totals]
|
58
48
|
options[:sort_tags] = options[:tag_sort]
|
59
49
|
|
60
|
-
Doing::Pager.page @wwid.list_date([start, finish], options[:section], options[:times], options[:output],
|
61
|
-
{ template: options[:template], config_template: options[:config_template], duration: options[:duration], totals: options[:totals], sort_tags: options[:sort_tags] }).chomp
|
50
|
+
Doing::Pager.page @wwid.list_date([start, finish], options[:section], options[:times], options[:output], options).chomp
|
62
51
|
end
|
63
52
|
end
|
data/bin/commands/tag_dir.rb
CHANGED
@@ -5,7 +5,7 @@ subdirectories will be tagged with the default tags. You can modify these any ti
|
|
5
5
|
manually editing the .doingrc file.'
|
6
6
|
arg_name 'TAG [TAG..]'
|
7
7
|
command :tag_dir do |c|
|
8
|
-
c.example 'doing tag_dir project1 project2', desc: 'Add @project1 and @
|
8
|
+
c.example 'doing tag_dir project1 project2', desc: 'Add @project1 and @project2 to to any entries created from the current directory'
|
9
9
|
c.example 'doing tag_dir --remove', desc: 'Clear the default tags for the directory'
|
10
10
|
|
11
11
|
c.desc 'Remove all default_tags from the local .doingrc'
|
@@ -16,14 +16,38 @@ command :tag_dir do |c|
|
|
16
16
|
|
17
17
|
cfg_cmd = commands[:config]
|
18
18
|
set_cmd = cfg_cmd.commands[:set]
|
19
|
-
|
19
|
+
|
20
|
+
set_options = { local: true }
|
20
21
|
if options[:remove]
|
21
22
|
set_args = ['default_tags']
|
22
23
|
set_options[:remove] = true
|
23
24
|
else
|
25
|
+
current_tags = Doing.setting('default_tags')
|
26
|
+
|
27
|
+
tags.delete_if do |tag|
|
28
|
+
if current_tags.include?(tag)
|
29
|
+
Doing.logger.info('Skipped:', "#{tag} is already applied by existing config")
|
30
|
+
true
|
31
|
+
else
|
32
|
+
false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
raise EmptyInput, 'No new tags provided' if tags.empty?
|
37
|
+
|
38
|
+
if File.exist?('.doingrc')
|
39
|
+
local = Doing::Util.safe_load_file('.doingrc')
|
40
|
+
dir_tags = local['default_tags'] || []
|
41
|
+
|
42
|
+
tags.concat(dir_tags)
|
43
|
+
tags.sort!.uniq!
|
44
|
+
|
45
|
+
raise UserCancelled, 'Tag(s) already exist for directory' if tags == dir_tags.sort
|
46
|
+
end
|
47
|
+
|
24
48
|
set_args = ['default_tags', tags.join(',')]
|
25
49
|
end
|
26
50
|
action = set_cmd.send(:get_action, nil)
|
27
|
-
|
51
|
+
action.call(global, set_options, set_args)
|
28
52
|
end
|
29
53
|
end
|
data/bin/commands/today.rb
CHANGED
@@ -12,20 +12,6 @@ command :today do |c|
|
|
12
12
|
c.arg_name 'NAME'
|
13
13
|
c.flag %i[s section], default_value: 'All'
|
14
14
|
|
15
|
-
c.desc 'Show time intervals on @done tasks'
|
16
|
-
c.switch %i[t times], default_value: true, negatable: true
|
17
|
-
|
18
|
-
c.desc 'Show elapsed time on entries without @done tag'
|
19
|
-
c.switch [:duration]
|
20
|
-
|
21
|
-
c.desc 'Show time totals at the end of output'
|
22
|
-
c.switch [:totals], default_value: false, negatable: false
|
23
|
-
|
24
|
-
c.desc 'Sort tags by (name|time)'
|
25
|
-
default = @settings['tag_sort'].normalize_tag_sort || :name
|
26
|
-
c.arg_name 'KEY'
|
27
|
-
c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
|
28
|
-
|
29
15
|
c.desc "Output to export format (#{Doing::Plugins.plugin_names(type: :export)})"
|
30
16
|
c.arg_name 'FORMAT'
|
31
17
|
c.flag %i[o output]
|
@@ -38,26 +24,15 @@ command :today do |c|
|
|
38
24
|
c.arg_name 'TEMPLATE_STRING'
|
39
25
|
c.flag [:template]
|
40
26
|
|
41
|
-
|
42
|
-
c
|
43
|
-
c.flag [:before]
|
44
|
-
|
45
|
-
c.desc 'View entries after specified time (e.g. 8am, 12:30pm, 15:00)'
|
46
|
-
c.arg_name 'TIME_STRING'
|
47
|
-
c.flag [:after]
|
48
|
-
|
49
|
-
c.desc %(
|
50
|
-
Time range to show `doing today --from "12pm to 4pm"`
|
51
|
-
)
|
52
|
-
c.arg_name 'TIME_RANGE'
|
53
|
-
c.flag [:from], type: DateRangeString
|
27
|
+
add_options(:time_filter, c)
|
28
|
+
add_options(:time_display, c)
|
54
29
|
|
55
30
|
c.action do |_global_options, options, _args|
|
56
31
|
raise DoingRuntimeError, %(Invalid output type "#{options[:output]}") if options[:output] && options[:output] !~ Doing::Plugins.plugin_regex(type: :export)
|
57
32
|
|
58
33
|
options[:times] = true if options[:totals]
|
59
34
|
options[:sort_tags] = options[:tag_sort]
|
60
|
-
filter_options = %i[after before duration from section sort_tags totals template config_template].each_with_object({}) { |k, hsh| hsh[k] = options[k] }
|
35
|
+
filter_options = %i[after before times duration from section sort_tags totals tag_order template config_template only_timed].each_with_object({}) { |k, hsh| hsh[k] = options[k] }
|
61
36
|
|
62
37
|
Doing::Pager.page @wwid.today(options[:times], options[:output], filter_options).chomp
|
63
38
|
end
|
data/bin/commands/view.rb
CHANGED
@@ -36,7 +36,7 @@ command :view do |c|
|
|
36
36
|
c.switch [:color], default_value: true, negatable: true
|
37
37
|
|
38
38
|
c.desc "Highlight search matches in output. Only affects command line output"
|
39
|
-
c.switch %i[h hilite], default_value:
|
39
|
+
c.switch %i[h hilite], default_value: Doing.settings.dig('search', 'highlight')
|
40
40
|
|
41
41
|
c.desc 'Sort tags by (name|time)'
|
42
42
|
c.arg_name 'KEY'
|
@@ -82,7 +82,7 @@ command :view do |c|
|
|
82
82
|
section = if options[:section]
|
83
83
|
@wwid.guess_section(options[:section]) || options[:section].cap_first
|
84
84
|
else
|
85
|
-
|
85
|
+
Doing.setting('current_section')
|
86
86
|
end
|
87
87
|
|
88
88
|
view = @wwid.get_view(title)
|
@@ -134,7 +134,7 @@ command :view do |c|
|
|
134
134
|
section = if options[:section]
|
135
135
|
section
|
136
136
|
else
|
137
|
-
view['section'] ||
|
137
|
+
view['section'] || Doing.setting('current_section')
|
138
138
|
end
|
139
139
|
order = if view.key?('order')
|
140
140
|
view['order'].normalize_order
|
data/bin/commands/yesterday.rb
CHANGED
@@ -23,49 +23,16 @@ command :yesterday do |c|
|
|
23
23
|
c.arg_name 'TEMPLATE_STRING'
|
24
24
|
c.flag [:template]
|
25
25
|
|
26
|
-
c
|
27
|
-
|
28
|
-
|
29
|
-
c.desc 'Show elapsed time on entries without @done tag'
|
30
|
-
c.switch [:duration]
|
31
|
-
|
32
|
-
c.desc 'Show time totals at the end of output'
|
33
|
-
c.switch [:totals], default_value: false, negatable: false
|
34
|
-
|
35
|
-
c.desc 'Sort tags by (name|time)'
|
36
|
-
default = @settings['tag_sort'].normalize_tag_sort || :name
|
37
|
-
c.arg_name 'KEY'
|
38
|
-
c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
|
39
|
-
|
40
|
-
c.desc 'View entries before specified time (e.g. 8am, 12:30pm, 15:00)'
|
41
|
-
c.arg_name 'TIME_STRING'
|
42
|
-
c.flag [:before]
|
43
|
-
|
44
|
-
c.desc 'View entries after specified time (e.g. 8am, 12:30pm, 15:00)'
|
45
|
-
c.arg_name 'TIME_STRING'
|
46
|
-
c.flag [:after]
|
47
|
-
|
48
|
-
c.desc 'Time range to show, e.g. `doing yesterday --from "1am to 8am"`'
|
49
|
-
c.arg_name 'TIME_RANGE'
|
50
|
-
c.flag [:from], must_match: REGEX_TIME_RANGE
|
51
|
-
|
52
|
-
c.desc 'Tag sort direction (asc|desc)'
|
53
|
-
c.arg_name 'DIRECTION'
|
54
|
-
c.flag [:tag_order], must_match: REGEX_SORT_ORDER, default_value: :asc, type: OrderSymbol
|
26
|
+
add_options(:time_filter, c)
|
27
|
+
add_options(:time_display, c)
|
55
28
|
|
56
29
|
c.action do |_global_options, options, _args|
|
57
30
|
raise DoingRuntimeError, %(Invalid output type "#{options[:output]}") if options[:output] && options[:output] !~ Doing::Plugins.plugin_regex(type: :export)
|
58
31
|
|
59
32
|
options[:sort_tags] = options[:tag_sort]
|
60
33
|
|
61
|
-
if options[:from]
|
62
|
-
options[:from] = options[:from].split(/#{REGEX_RANGE_INDICATOR}/).map do |time|
|
63
|
-
"yesterday #{time.sub(/(?mi)(^.*?(?=\d+)|(?<=[ap]m).*?$)/, '')}"
|
64
|
-
end.join(' to ').split_date_range
|
65
|
-
end
|
66
|
-
|
67
34
|
opt = options.clone
|
68
|
-
opt[:order] =
|
35
|
+
opt[:order] = Doing.setting(['templates', options[:config_template], 'order'])
|
69
36
|
|
70
37
|
Doing::Pager.page @wwid.yesterday(options[:section], options[:times], options[:output], opt).chomp
|
71
38
|
end
|