doing 2.1.29 → 2.1.33

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/.irbrc +1 -0
  3. data/CHANGELOG.md +4962 -0
  4. data/Dockerfile-2.6 +3 -1
  5. data/Dockerfile-2.7 +4 -2
  6. data/Dockerfile-3.0 +3 -1
  7. data/Gemfile.lock +2 -67
  8. data/README.md +1 -1
  9. data/bash_profile +13 -0
  10. data/bin/commands/again.rb +1 -1
  11. data/bin/commands/archive.rb +3 -3
  12. data/bin/commands/cancel.rb +1 -1
  13. data/bin/commands/changes.rb +2 -2
  14. data/bin/commands/commands.rb +8 -8
  15. data/bin/commands/completion.rb +61 -19
  16. data/bin/commands/config.rb +20 -17
  17. data/bin/commands/done.rb +1 -1
  18. data/bin/commands/flag.rb +1 -1
  19. data/bin/commands/grep.rb +5 -5
  20. data/bin/commands/last.rb +1 -1
  21. data/bin/commands/meanwhile.rb +1 -1
  22. data/bin/commands/now.rb +1 -1
  23. data/bin/commands/on.rb +1 -1
  24. data/bin/commands/open.rb +4 -4
  25. data/bin/commands/recent.rb +4 -4
  26. data/bin/commands/show.rb +8 -8
  27. data/bin/commands/since.rb +1 -1
  28. data/bin/commands/tag_dir.rb +27 -3
  29. data/bin/commands/today.rb +1 -1
  30. data/bin/commands/view.rb +3 -3
  31. data/bin/commands/yesterday.rb +2 -2
  32. data/bin/doing +26 -135
  33. data/docs/doc/Array.html +1 -1
  34. data/docs/doc/BooleanTermParser/Clause.html +1 -1
  35. data/docs/doc/BooleanTermParser/Operator.html +1 -1
  36. data/docs/doc/BooleanTermParser/Query.html +1 -1
  37. data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
  38. data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
  39. data/docs/doc/BooleanTermParser.html +1 -1
  40. data/docs/doc/Doing/Color.html +1 -1
  41. data/docs/doc/Doing/Completion.html +324 -4
  42. data/docs/doc/Doing/Configuration.html +3 -3
  43. data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
  44. data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
  45. data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
  46. data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
  47. data/docs/doc/Doing/Errors/NoResults.html +1 -1
  48. data/docs/doc/Doing/Errors/PluginException.html +1 -1
  49. data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
  50. data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
  51. data/docs/doc/Doing/Errors.html +1 -1
  52. data/docs/doc/Doing/Hooks.html +1 -1
  53. data/docs/doc/Doing/Item.html +125 -1
  54. data/docs/doc/Doing/Items.html +1 -1
  55. data/docs/doc/Doing/LogAdapter.html +1 -1
  56. data/docs/doc/Doing/Note.html +109 -3
  57. data/docs/doc/Doing/Pager.html +1 -1
  58. data/docs/doc/Doing/Plugins.html +1 -1
  59. data/docs/doc/Doing/Prompt.html +1 -1
  60. data/docs/doc/Doing/Section.html +1 -1
  61. data/docs/doc/Doing/TemplateString.html +1 -1
  62. data/docs/doc/Doing/Types.html +2 -2
  63. data/docs/doc/Doing/Util/Backup.html +1 -1
  64. data/docs/doc/Doing/Util.html +1 -1
  65. data/docs/doc/Doing/WWID.html +6 -6
  66. data/docs/doc/Doing.html +2 -2
  67. data/docs/doc/FalseClass.html +1 -1
  68. data/docs/doc/GLI/Commands/Help.html +1 -1
  69. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  70. data/docs/doc/GLI/Commands.html +1 -1
  71. data/docs/doc/GLI.html +1 -1
  72. data/docs/doc/Hash.html +1 -1
  73. data/docs/doc/Object.html +1 -1
  74. data/docs/doc/PhraseParser/Operator.html +1 -1
  75. data/docs/doc/PhraseParser/PhraseClause.html +1 -1
  76. data/docs/doc/PhraseParser/Query.html +1 -1
  77. data/docs/doc/PhraseParser/QueryParser.html +1 -1
  78. data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
  79. data/docs/doc/PhraseParser/TermClause.html +1 -1
  80. data/docs/doc/PhraseParser.html +1 -1
  81. data/docs/doc/Status.html +1 -1
  82. data/docs/doc/String.html +1 -1
  83. data/docs/doc/Symbol.html +1 -1
  84. data/docs/doc/Time.html +1 -1
  85. data/docs/doc/TrueClass.html +1 -1
  86. data/docs/doc/_index.html +3 -1
  87. data/docs/doc/file.README.html +2 -2
  88. data/docs/doc/index.html +2 -2
  89. data/docs/doc/method_list.html +337 -241
  90. data/docs/doc/top-level-namespace.html +105 -1
  91. data/docs/index.md +1 -1
  92. data/doing.gemspec +24 -23
  93. data/doing.rdoc +34 -13
  94. data/example_plugin.rb +7 -5
  95. data/inputrc +57 -0
  96. data/lib/completion/_doing.zsh +46 -46
  97. data/lib/completion/doing.bash +2 -2
  98. data/lib/completion/doing.fish +4 -4
  99. data/lib/doing/add_options.rb +117 -0
  100. data/lib/doing/array/array.rb +16 -0
  101. data/lib/doing/changelog/changes.rb +8 -6
  102. data/lib/doing/changelog/version.rb +11 -3
  103. data/lib/doing/completion/bash_completion.rb +12 -51
  104. data/lib/doing/completion/fish_completion.rb +17 -53
  105. data/lib/doing/completion/zsh_completion.rb +21 -54
  106. data/lib/doing/completion.rb +203 -17
  107. data/lib/doing/configuration.rb +12 -6
  108. data/lib/doing/item.rb +21 -3
  109. data/lib/doing/items.rb +5 -5
  110. data/lib/doing/note.rb +24 -8
  111. data/lib/doing/plugins/export/dayone_export.rb +8 -6
  112. data/lib/doing/plugins/export/html_export.rb +4 -4
  113. data/lib/doing/plugins/export/json_export.rb +19 -20
  114. data/lib/doing/plugins/export/markdown_export.rb +2 -2
  115. data/lib/doing/plugins/export/template_export.rb +4 -4
  116. data/lib/doing/plugins/import/calendar_import.rb +1 -1
  117. data/lib/doing/plugins/import/doing_import.rb +1 -1
  118. data/lib/doing/plugins/import/timing_import.rb +1 -1
  119. data/lib/doing/section.rb +1 -1
  120. data/lib/doing/string/highlight.rb +3 -4
  121. data/lib/doing/string/string.rb +8 -0
  122. data/lib/doing/types.rb +1 -1
  123. data/lib/doing/util.rb +1 -1
  124. data/lib/doing/util_backup.rb +12 -12
  125. data/lib/doing/version.rb +1 -1
  126. data/lib/doing/wwid.rb +75 -76
  127. data/lib/doing.rb +58 -0
  128. data/lib/examples/commands/wiki.rb +27 -19
  129. data/lib/helpers/threaded_tests.rb +2 -0
  130. data/scripts/setting_replace.rb +11 -0
  131. metadata +107 -102
  132. data/.yardoc/checksums +0 -29
  133. data/.yardoc/complete +0 -0
  134. data/.yardoc/object_types +0 -0
  135. data/.yardoc/objects/root.dat +0 -0
  136. data/.yardoc/proxy_types +0 -0
@@ -30,7 +30,7 @@ command :recent do |c|
30
30
  c.switch [:totals], default_value: false, negatable: false
31
31
 
32
32
  c.desc 'Sort tags by (name|time)'
33
- default = @settings['tag_sort'].normalize_tag_sort || :name
33
+ default = Doing.setting('tag_sort').normalize_tag_sort || :name
34
34
  c.arg_name 'KEY'
35
35
  c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
36
36
 
@@ -41,8 +41,8 @@ command :recent do |c|
41
41
  section = @wwid.guess_section(options[:section]) || options[:section].cap_first
42
42
 
43
43
  unless global_options[:version]
44
- if @settings['templates']['recent'].key?('count')
45
- config_count = @settings['templates']['recent']['count'].to_i
44
+ if Doing.setting('templates.recent.count')
45
+ config_count = Doing.setting('templates.recent.count').to_i
46
46
  else
47
47
  config_count = 10
48
48
  end
@@ -56,7 +56,7 @@ command :recent do |c|
56
56
  options[:times] = true if options[:totals]
57
57
  options[:sort_tags] = options[:tag_sort]
58
58
 
59
- template = @settings['templates']['recent'].deep_merge(@settings['templates']['default'])
59
+ template = Doing.setting('templates.recent').deep_merge(Doing.setting('templates.default'))
60
60
  tags_color = template.key?('tags_color') ? template['tags_color'] : nil
61
61
 
62
62
  opts = {
data/bin/commands/show.rb CHANGED
@@ -27,7 +27,7 @@ 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: @settings.dig('search', 'highlight')
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'
@@ -43,7 +43,7 @@ command :show do |c|
43
43
  c.switch [:totals], default_value: false, negatable: false
44
44
 
45
45
  c.desc 'Sort tags by (name|time)'
46
- default = @settings['tag_sort'].normalize_tag_sort || :name
46
+ default = Doing.setting('tag_sort').normalize_tag_sort || :name
47
47
  c.arg_name 'KEY'
48
48
  c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
49
49
 
@@ -118,7 +118,7 @@ command :show do |c|
118
118
  end
119
119
  end
120
120
  else
121
- section = options[:menu] ? @wwid.choose_section(include_all: true) : @settings['current_section']
121
+ section = options[:menu] ? @wwid.choose_section(include_all: true) : Doing.setting('current_section')
122
122
  section ||= 'All'
123
123
  end
124
124
 
@@ -126,11 +126,11 @@ command :show do |c|
126
126
 
127
127
  options[:times] = true if options[:totals]
128
128
 
129
- template = @settings['templates'][options[:config_template]].deep_merge({
130
- 'wrap_width' => @settings['wrap_width'] || 0,
131
- 'date_format' => @settings['default_date_format'],
132
- 'order' => @settings['order']&.normalize_order || :asc,
133
- 'tags_color' => @settings['tags_color']
129
+ template = Doing.setting(['templates', options[:config_template]]).deep_merge({
130
+ 'wrap_width' => Doing.setting('wrap_width') || 0,
131
+ 'date_format' => Doing.setting('default_date_format'),
132
+ 'order' => Doing.setting('order')&.normalize_order || :asc,
133
+ 'tags_color' => Doing.setting('tags_color')
134
134
  })
135
135
 
136
136
  if options[:search]
@@ -21,7 +21,7 @@ command :since do |c|
21
21
  c.switch [:totals], default_value: false, negatable: false
22
22
 
23
23
  c.desc 'Sort tags by (name|time)'
24
- default = @settings['tag_sort'].normalize_tag_sort || :name
24
+ default = Doing.setting('tag_sort').normalize_tag_sort || :name
25
25
  c.arg_name 'KEY'
26
26
  c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
27
27
 
@@ -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 @project to to any entries in the current directory'
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
- set_options = {}
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
- return action.call(global, set_options, set_args)
51
+ action.call(global, set_options, set_args)
28
52
  end
29
53
  end
@@ -22,7 +22,7 @@ command :today do |c|
22
22
  c.switch [:totals], default_value: false, negatable: false
23
23
 
24
24
  c.desc 'Sort tags by (name|time)'
25
- default = @settings['tag_sort'].normalize_tag_sort || :name
25
+ default = Doing.setting('tag_sort').normalize_tag_sort || :name
26
26
  c.arg_name 'KEY'
27
27
  c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
28
28
 
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: @settings.dig('search', 'highlight')
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
- @settings['current_section']
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'] || @settings['current_section']
137
+ view['section'] || Doing.setting('current_section')
138
138
  end
139
139
  order = if view.key?('order')
140
140
  view['order'].normalize_order
@@ -33,7 +33,7 @@ command :yesterday do |c|
33
33
  c.switch [:totals], default_value: false, negatable: false
34
34
 
35
35
  c.desc 'Sort tags by (name|time)'
36
- default = @settings['tag_sort'].normalize_tag_sort || :name
36
+ default = Doing.setting('tag_sort').normalize_tag_sort || :name
37
37
  c.arg_name 'KEY'
38
38
  c.flag [:tag_sort], must_match: REGEX_TAG_SORT, default_value: default, type: TagSortSymbol
39
39
 
@@ -65,7 +65,7 @@ command :yesterday do |c|
65
65
  end
66
66
 
67
67
  opt = options.clone
68
- opt[:order] = @settings.dig('templates', options[:config_template], 'order')
68
+ opt[:order] = Doing.setting(['templates', options[:config_template], 'order'])
69
69
 
70
70
  Doing::Pager.page @wwid.yesterday(options[:section], options[:times], options[:output], opt).chomp
71
71
  end
data/bin/doing CHANGED
@@ -4,6 +4,7 @@
4
4
  $LOAD_PATH.unshift File.join(__dir__, '..', 'lib')
5
5
  require 'gli'
6
6
  require 'doing/help_monkey_patch'
7
+ require 'doing/add_options'
7
8
  require 'doing'
8
9
  require 'tempfile'
9
10
  require 'pp'
@@ -26,6 +27,7 @@ include Doing::Errors
26
27
  version Doing::VERSION
27
28
  hide_commands_without_desc true
28
29
  autocomplete_commands true
30
+ wrap_help_text :one_line unless $stdout.isatty
29
31
 
30
32
  include Doing::Types
31
33
 
@@ -35,7 +37,9 @@ include Doing::Types
35
37
  Doing.logger.log_level = :info
36
38
  env_log_level = nil
37
39
 
38
- if ENV['DOING_LOG_LEVEL'] || ENV['DOING_DEBUG'] || ENV['DOING_QUIET'] || ENV['DOING_VERBOSE'] || ENV['DOING_PLUGIN_DEBUG']
40
+ if ENV['DOING_LOG_LEVEL'] ||
41
+ ENV['DOING_DEBUG'] || ENV['DOING_QUIET'] ||
42
+ ENV['DOING_VERBOSE'] || ENV['DOING_PLUGIN_DEBUG']
39
43
  env_log_level = true
40
44
  # Quiet always wins
41
45
  if ENV['DOING_QUIET']&.truthy?
@@ -53,21 +57,20 @@ Doing.logger.benchmark(:total, :start)
53
57
 
54
58
  Doing.logger.benchmark(:configure, :start)
55
59
  Doing.config_with(ENV['DOING_CONFIG'], { ignore_local: true }) if ENV['DOING_CONFIG']
56
- @config = Doing.config
57
60
  Doing.logger.benchmark(:configure, :finish)
58
61
 
59
- @config.settings['backup_dir'] = ENV['DOING_BACKUP_DIR'] if ENV['DOING_BACKUP_DIR']
60
- @settings = @config.settings
61
- @wwid.config = @settings
62
+ Doing.set('backup_dir', ENV['DOING_BACKUP_DIR']) if ENV['DOING_BACKUP_DIR']
62
63
 
63
- commands_from File.expand_path(@settings.dig('plugins', 'command_path')) if @settings.dig('plugins', 'command_path')
64
+ # Set up class vars for backwards compatibility
65
+ @settings = Doing.settings
66
+ @wwid.config = Doing.settings
64
67
 
65
68
  accept BooleanSymbol do |value|
66
69
  value.normalize_bool(:pattern)
67
70
  end
68
71
 
69
72
  accept CaseSymbol do |value|
70
- value.normalize_case(@config.fetch('search', 'case', :smart))
73
+ value.normalize_case(Doing.config.fetch('search', 'case', :smart))
71
74
  end
72
75
 
73
76
  accept AgeSymbol do |value|
@@ -83,11 +86,11 @@ accept MatchingSymbol do |value|
83
86
  end
84
87
 
85
88
  accept TagSortSymbol do |value|
86
- value.normalize_tag_sort(@config.fetch('tag_sort', :name))
89
+ value.normalize_tag_sort(Doing.config.fetch('tag_sort', :name))
87
90
  end
88
91
 
89
92
  accept TemplateName do |value|
90
- res = @settings['templates'].keys.select { |k| k =~ value.to_rx(distance: 2) }
93
+ res = Doing.setting('templates').keys.select { |k| k =~ value.to_rx(distance: 2) }
91
94
  raise InvalidArgument, "Unknown template: #{value}" unless res.good?
92
95
 
93
96
  res.group_by(&:length).min.last[0]
@@ -141,121 +144,7 @@ accept TagArray do |value|
141
144
  value.gsub(/[, ]+/, ' ').split(' ').map { |tag| tag.sub(/^@/, '') }.map(&:strip)
142
145
  end
143
146
 
144
- ##
145
- ## Add presets of flags and switches to a command.
146
- ##
147
- ## :add_entry => --noauto, --note, --ask, --editor, --back
148
- ##
149
- ## :search => --search, --case, --exact
150
- ##
151
- ## :tag_filter => --tag, --bool, --not, --val
152
- ##
153
- ## :date_filter => --before, --after, --from
154
- ##
155
- ## @param type [Symbol] The type
156
- ## @param cmd The GLI command to which the options will be added
157
- ##
158
- def add_options(type, cmd)
159
- cmd_name = cmd.name.to_s
160
- action = case cmd_name
161
- when /again/
162
- 'Repeat'
163
- when /grep/
164
- 'Search'
165
- when /mark/
166
- 'Flag'
167
- when /(last|tags|view)/
168
- 'Show'
169
- else
170
- cmd_name.capitalize
171
- end
172
-
173
- case type
174
- when :add_entry
175
- cmd.desc 'Exclude auto tags and default tags'
176
- cmd.switch %i[X noauto], default_value: false, negatable: false
177
-
178
- cmd.desc 'Include a note'
179
- cmd.arg_name 'TEXT'
180
- cmd.flag %i[n note]
181
-
182
- cmd.desc 'Prompt for note via multi-line input'
183
- cmd.switch %i[ask], negatable: false, default_value: false
184
-
185
- cmd.desc "Edit entry with #{Doing::Util.default_editor}"
186
- cmd.switch %i[e editor], negatable: false, default_value: false
187
-
188
- cmd.desc 'Backdate start date for new entry to date string [4pm|20m|2h|yesterday noon]'
189
- cmd.arg_name 'DATE_STRING'
190
- cmd.flag %i[b back started], type: DateBeginString
191
- when :search
192
- cmd.desc 'Filter entries using a search query, surround with slashes for regex (e.g. "/query.*/"),
193
- start with single quote for exact match ("\'query")'
194
- cmd.arg_name 'QUERY'
195
- cmd.flag [:search]
196
-
197
- cmd.desc 'Case sensitivity for search string matching [(c)ase-sensitive, (i)gnore, (s)mart]'
198
- cmd.arg_name 'TYPE'
199
- cmd.flag [:case], must_match: REGEX_CASE,
200
- default_value: @settings.dig('search', 'case').normalize_case,
201
- type: CaseSymbol
202
-
203
- cmd.desc 'Force exact search string matching (case sensitive)'
204
- cmd.switch %i[x exact], default_value: @config.exact_match?, negatable: @config.exact_match?
205
- when :tag_filter
206
- cmd.desc 'Filter entries by tag. Combine multiple tags with a comma. Wildcards allowed (*, ?)'
207
- cmd.arg_name 'TAG'
208
- cmd.flag [:tag], type: TagArray
209
-
210
- cmd.desc 'Perform a tag value query ("@done > two hours ago" or "@progress < 50").
211
- May be used multiple times, combined with --bool'
212
- cmd.arg_name 'QUERY'
213
- cmd.flag [:val], multiple: true, must_match: REGEX_VALUE_QUERY
214
-
215
- cmd.desc "#{action} items that *don't* match search/tag filters"
216
- cmd.switch [:not], default_value: false, negatable: false
217
-
218
- cmd.desc 'Boolean used to combine multiple tags. Use PATTERN to parse + and - as booleans'
219
- cmd.arg_name 'BOOLEAN'
220
- cmd.flag [:bool], must_match: REGEX_BOOL,
221
- default_value: :pattern,
222
- type: BooleanSymbol
223
- when :date_filter
224
- if action =~ /Archive/
225
- cmd.desc 'Archive entries older than date (natural language).'
226
- else
227
- cmd.desc "#{action} entries older than date (natural language). If this is only a time (8am, 1:30pm, 15:00), all
228
- dates will be included, but entries will be filtered by time of day"
229
- end
230
- cmd.arg_name 'DATE_STRING'
231
- cmd.flag [:before], type: DateBeginString
232
-
233
- if action =~ /Archive/
234
- cmd.desc 'Archive entries newer than date (natural language).'
235
- else
236
- cmd.desc "#{action} entries newer than date (natural language). If this is only a time (8am, 1:30pm, 15:00), all
237
- dates will be included, but entries will be filtered by time of day"
238
- end
239
- cmd.arg_name 'DATE_STRING'
240
- cmd.flag [:after], type: DateEndString
241
-
242
- if action =~ /Archive/
243
- cmd.desc %(
244
- Date range (natural language) to archive: `doing archive --from "1/1/21 to 12/31/21"`.
245
- )
246
- else
247
- cmd.desc %(
248
- Date range (natural language) to #{action.downcase}, or a single day to filter on.
249
- To specify a range, use "to": `doing #{cmd_name} --from "monday 8am to friday 5pm"`.
250
-
251
- If values are only time(s) (6am to noon) all dates will be included, but entries will be filtered
252
- by time of day.
253
- )
254
- end
255
- cmd.arg_name 'DATE_OR_RANGE'
256
- cmd.flag [:from], type: DateRangeString
257
- end
258
- end
147
+ commands_from File.expand_path(Doing.setting('plugins.command_path')) if Doing.setting('plugins.command_path')
259
148
 
260
149
  program_desc 'A CLI for a What Was I Doing system'
261
150
  program_long_desc %(Doing uses a TaskPaper-like formatting to keep a plain text
@@ -275,7 +164,7 @@ desc 'Send results report to STDOUT instead of STDERR'
275
164
  switch [:stdout], default_value: false, negatable: false
276
165
 
277
166
  desc 'Use a pager when output is longer than screen'
278
- switch %i[p pager], default_value: @settings['paginate']
167
+ switch %i[p pager], default_value: Doing.setting('paginate')
279
168
 
280
169
  desc 'Answer yes/no menus with default option'
281
170
  switch [:default], default_value: false, negatable: false
@@ -299,14 +188,14 @@ desc 'Verbose output'
299
188
  switch %i[debug], default_value: false, negatable: false
300
189
 
301
190
  desc 'Use a specific configuration file. Deprecated, set $DOING_CONFIG instead'
302
- flag [:config_file], default_value: @config.config_file
191
+ flag [:config_file], default_value: Doing.config.config_file
303
192
 
304
193
  desc 'Specify a different doing_file'
305
194
  flag %i[f doing_file]
306
195
 
307
196
  def add_commands(commands)
308
197
  commands = [commands] unless commands.is_a?(Array)
309
- hidden = @settings['disabled_commands']
198
+ hidden = Doing.setting('disabled_commands')
310
199
  hidden = hidden.set_type('array') if hidden.good? && !hidden.is_a?(Array)
311
200
  commands.delete_if { |c| hidden.include?(c) }
312
201
  commands.each { |cmd| require_relative "commands/#{cmd}" }
@@ -328,7 +217,7 @@ add_commands(%w[commands_accepting install_fzf])
328
217
  add_commands(%w[again cancel flag meanwhile reset tags today yesterday since add_section tag_dir colors completion plugins sections template views changes])
329
218
 
330
219
  pre do |global, _command, _options, _args|
331
- # global[:pager] ||= @settings['paginate']
220
+ # global[:pager] ||= Doing.setting('paginate')
332
221
  Doing::Pager.paginate = global[:pager]
333
222
 
334
223
  $stdout.puts "doing v#{Doing::VERSION}" if global[:version]
@@ -347,7 +236,7 @@ end
347
236
 
348
237
  on_error do |exception|
349
238
  if exception.kind_of?(GLI::UnknownCommand)
350
- exit run(['now'].concat(ARGV))
239
+ exit run(['now'].concat(ARGV.unshift(@command)))
351
240
  elsif exception.kind_of?(SystemExit)
352
241
  false
353
242
  else
@@ -366,8 +255,8 @@ post do |global, _command, _options, _args|
366
255
  end
367
256
 
368
257
  around do |global, command, options, arguments, code|
369
- Doing.logger.benchmark("command_#{command.name.to_s}".to_sym, :start)
370
- # Doing.logger.debug('Pager:', "Global: #{global[:pager]}, Config: #{@settings['paginate']}, Pager: #{Doing::Pager.paginate}")
258
+ Doing.logger.benchmark("command_#{command.name}".to_sym, :start)
259
+ # Doing.logger.debug('Pager:', "Global: #{global[:pager]}, Config: #{Doing.setting('paginate')}, Pager: #{Doing::Pager.paginate}")
371
260
  if env_log_level.nil?
372
261
  Doing.logger.adjust_verbosity(global)
373
262
  end
@@ -392,15 +281,15 @@ around do |global, command, options, arguments, code|
392
281
  Doing.config.force_answer = global[:default] ? true : false
393
282
  end
394
283
 
395
- if global[:config_file] && global[:config_file] != @config.config_file
284
+ if global[:config_file] && global[:config_file] != Doing.config.config_file
396
285
  Doing.logger.warn(format('%sWARNING:%s %sThe use of --config_file is deprecated, please set the environment variable DOING_CONFIG instead.', @colors.flamingo, @colors.default, @colors.boldred))
397
286
  Doing.logger.warn(format('%sTo set it just for the current command, use: %sDOING_CONFIG=/path/to/doingrc doing [command]%s', @colors.red, @colors.boldwhite, @colors.default))
398
287
 
399
288
  cf = File.expand_path(global[:config_file])
400
289
  raise MissingConfigFile, "Config file not found (#{global[:config_file]})" unless File.exist?(cf)
401
290
 
402
- @config.config_file = cf
403
- @settings = @config.configure({ ignore_local: true })
291
+ Doing.config.config_file = cf
292
+ Doing.config_with(cf, { ignore_local: true })
404
293
  end
405
294
  Doing.logger.benchmark(:init, :start)
406
295
  if global[:doing_file]
@@ -411,7 +300,7 @@ around do |global, command, options, arguments, code|
411
300
  Doing.logger.benchmark(:init, :finish)
412
301
  @wwid.auto_tag = !global[:noauto]
413
302
 
414
- @settings[:include_notes] = false unless global[:notes]
303
+ Doing.set('include_notes', false) unless global[:notes]
415
304
 
416
305
  global[:wwid] = @wwid
417
306
 
@@ -420,4 +309,6 @@ around do |global, command, options, arguments, code|
420
309
  Doing.logger.benchmark("command_#{command.name.to_s}".to_sym, :finish)
421
310
  end
422
311
 
312
+ @command = ARGV[0]
313
+
423
314
  exit run(ARGV)
data/docs/doc/Array.html CHANGED
@@ -195,7 +195,7 @@ has content</p>
195
195
  </div>
196
196
 
197
197
  <div id="footer">
198
- Generated on Mon Feb 14 14:34:40 2022 by
198
+ Generated on Fri Feb 18 12:22:35 2022 by
199
199
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
200
200
  0.9.27 (ruby-3.0.1).
201
201
  </div>
@@ -283,7 +283,7 @@
283
283
  </div>
284
284
 
285
285
  <div id="footer">
286
- Generated on Mon Feb 14 14:34:40 2022 by
286
+ Generated on Fri Feb 18 12:22:39 2022 by
287
287
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
288
288
  0.9.27 (ruby-3.0.1).
289
289
  </div>
@@ -162,7 +162,7 @@
162
162
  </div>
163
163
 
164
164
  <div id="footer">
165
- Generated on Mon Feb 14 14:34:40 2022 by
165
+ Generated on Fri Feb 18 12:22:39 2022 by
166
166
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
167
167
  0.9.27 (ruby-3.0.1).
168
168
  </div>
@@ -407,7 +407,7 @@
407
407
  </div>
408
408
 
409
409
  <div id="footer">
410
- Generated on Mon Feb 14 14:34:40 2022 by
410
+ Generated on Fri Feb 18 12:22:39 2022 by
411
411
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
412
412
  0.9.27 (ruby-3.0.1).
413
413
  </div>
@@ -125,7 +125,7 @@ parser. In order to do that, a new &quot;clause&quot; node is added to the parse
125
125
  </div>
126
126
 
127
127
  <div id="footer">
128
- Generated on Mon Feb 14 14:34:40 2022 by
128
+ Generated on Fri Feb 18 12:22:39 2022 by
129
129
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
130
130
  0.9.27 (ruby-3.0.1).
131
131
  </div>
@@ -114,7 +114,7 @@
114
114
  </div>
115
115
 
116
116
  <div id="footer">
117
- Generated on Mon Feb 14 14:34:40 2022 by
117
+ Generated on Fri Feb 18 12:22:39 2022 by
118
118
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
119
119
  0.9.27 (ruby-3.0.1).
120
120
  </div>
@@ -105,7 +105,7 @@
105
105
  </div>
106
106
 
107
107
  <div id="footer">
108
- Generated on Mon Feb 14 14:34:40 2022 by
108
+ Generated on Fri Feb 18 12:22:35 2022 by
109
109
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
110
110
  0.9.27 (ruby-3.0.1).
111
111
  </div>
@@ -518,7 +518,7 @@ ANSI-sequences are stripped from the string.</p>
518
518
  </div>
519
519
 
520
520
  <div id="footer">
521
- Generated on Mon Feb 14 14:34:40 2022 by
521
+ Generated on Fri Feb 18 12:22:35 2022 by
522
522
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
523
523
  0.9.27 (ruby-3.0.1).
524
524
  </div>