doing 2.1.33 → 2.1.36

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.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +39 -0
  3. data/Gemfile.lock +1 -5
  4. data/README.md +1 -1
  5. data/bin/commands/config.rb +11 -11
  6. data/bin/commands/done.rb +2 -2
  7. data/bin/commands/grep.rb +2 -29
  8. data/bin/commands/meanwhile.rb +1 -1
  9. data/bin/commands/now.rb +1 -1
  10. data/bin/commands/on.rb +6 -16
  11. data/bin/commands/open.rb +2 -2
  12. data/bin/commands/recent.rb +2 -14
  13. data/bin/commands/rotate.rb +17 -0
  14. data/bin/commands/sections.rb +82 -7
  15. data/bin/commands/show.rb +1 -21
  16. data/bin/commands/since.rb +5 -16
  17. data/bin/commands/today.rb +3 -28
  18. data/bin/commands/yesterday.rb +2 -35
  19. data/bin/doing +5 -6
  20. data/docs/doc/Array.html +1 -1
  21. data/docs/doc/BooleanTermParser/Clause.html +1 -1
  22. data/docs/doc/BooleanTermParser/Operator.html +1 -1
  23. data/docs/doc/BooleanTermParser/Query.html +1 -1
  24. data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
  25. data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
  26. data/docs/doc/BooleanTermParser.html +1 -1
  27. data/docs/doc/Doing/Color.html +1 -1
  28. data/docs/doc/Doing/Completion.html +1 -1
  29. data/docs/doc/Doing/Configuration.html +1 -1
  30. data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
  31. data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
  32. data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
  33. data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
  34. data/docs/doc/Doing/Errors/NoResults.html +1 -1
  35. data/docs/doc/Doing/Errors/PluginException.html +1 -1
  36. data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
  37. data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
  38. data/docs/doc/Doing/Errors.html +1 -1
  39. data/docs/doc/Doing/Hooks.html +1 -1
  40. data/docs/doc/Doing/Item.html +20 -3
  41. data/docs/doc/Doing/Items.html +209 -1
  42. data/docs/doc/Doing/Logger.html +1807 -0
  43. data/docs/doc/Doing/Note.html +1 -1
  44. data/docs/doc/Doing/Pager.html +1 -1
  45. data/docs/doc/Doing/Plugins.html +1 -1
  46. data/docs/doc/Doing/Prompt.html +1 -1
  47. data/docs/doc/Doing/Section.html +1 -1
  48. data/docs/doc/Doing/TemplateString.html +1 -1
  49. data/docs/doc/Doing/Types.html +2 -2
  50. data/docs/doc/Doing/Util/Backup.html +1 -1
  51. data/docs/doc/Doing/Util.html +1 -1
  52. data/docs/doc/Doing/WWID.html +3 -53
  53. data/docs/doc/Doing.html +4 -4
  54. data/docs/doc/FalseClass.html +1 -1
  55. data/docs/doc/GLI/Commands/Help.html +1 -1
  56. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  57. data/docs/doc/GLI/Commands.html +1 -1
  58. data/docs/doc/GLI.html +1 -1
  59. data/docs/doc/Hash.html +1 -1
  60. data/docs/doc/Object.html +1 -1
  61. data/docs/doc/PhraseParser/Operator.html +1 -1
  62. data/docs/doc/PhraseParser/PhraseClause.html +1 -1
  63. data/docs/doc/PhraseParser/Query.html +1 -1
  64. data/docs/doc/PhraseParser/QueryParser.html +1 -1
  65. data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
  66. data/docs/doc/PhraseParser/TermClause.html +1 -1
  67. data/docs/doc/PhraseParser.html +1 -1
  68. data/docs/doc/Status.html +1 -1
  69. data/docs/doc/String.html +1 -1
  70. data/docs/doc/Symbol.html +1 -1
  71. data/docs/doc/Time.html +1 -1
  72. data/docs/doc/TrueClass.html +1 -1
  73. data/docs/doc/_index.html +10 -10
  74. data/docs/doc/class_list.html +1 -1
  75. data/docs/doc/file.README.html +2 -2
  76. data/docs/doc/index.html +2 -2
  77. data/docs/doc/method_list.html +407 -383
  78. data/docs/doc/top-level-namespace.html +1 -1
  79. data/doing.gemspec +0 -1
  80. data/doing.rdoc +229 -17
  81. data/lib/completion/_doing.zsh +11 -15
  82. data/lib/completion/doing.bash +12 -23
  83. data/lib/completion/doing.fish +38 -12
  84. data/lib/doing/add_options.rb +36 -1
  85. data/lib/doing/chronify/string.rb +1 -1
  86. data/lib/doing/item.rb +9 -2
  87. data/lib/doing/items.rb +48 -0
  88. data/lib/doing/{log_adapter.rb → logger.rb} +8 -2
  89. data/lib/doing/plugins/import/calendar_import.rb +1 -1
  90. data/lib/doing/plugins/import/doing_import.rb +1 -1
  91. data/lib/doing/plugins/import/timing_import.rb +1 -1
  92. data/lib/doing/string/tags.rb +1 -1
  93. data/lib/doing/types.rb +1 -1
  94. data/lib/doing/version.rb +1 -1
  95. data/lib/doing/wwid.rb +43 -43
  96. data/lib/doing.rb +4 -4
  97. data/lib/examples/plugins/capture_thing_import.rb +1 -1
  98. metadata +4 -24
  99. data/bin/commands/add_section.rb +0 -15
data/lib/doing/wwid.rb CHANGED
@@ -14,7 +14,7 @@ module Doing
14
14
  class WWID
15
15
  attr_reader :additional_configs, :current_section, :doing_file, :content
16
16
 
17
- attr_accessor :config, :config_file, :auto_tag, :default_option
17
+ attr_accessor :config, :config_file, :default_option
18
18
 
19
19
  include Color
20
20
  # include Util
@@ -26,7 +26,12 @@ module Doing
26
26
  @timers = {}
27
27
  @recorded_items = []
28
28
  @content = Items.new
29
- @auto_tag = true
29
+ Doing.auto_tag = true
30
+ end
31
+
32
+ # For backwards compatibility where @wwid.config was accessed instead of Doing.config.settings
33
+ def config
34
+ Doing.config.settings
30
35
  end
31
36
 
32
37
  ##
@@ -354,7 +359,7 @@ module Doing
354
359
  title = [title.strip.cap_first]
355
360
  title = title.join(' ')
356
361
 
357
- if @auto_tag
362
+ if Doing.auto_tag
358
363
  title = autotag(title)
359
364
  title.add_tags!(Doing.setting('default_tags')) if Doing.setting('default_tags').good?
360
365
  end
@@ -499,7 +504,7 @@ module Doing
499
504
  # Remove @done tag
500
505
  title = item.title.sub(/\s*@done(\(.*?\))?/, '').chomp
501
506
  section = opt[:in].nil? ? item.section : guess_section(opt[:in])
502
- @auto_tag = false
507
+ Doing.auto_tag = false
503
508
 
504
509
  note = opt[:note] || Note.new
505
510
 
@@ -667,12 +672,14 @@ module Doing
667
672
  items = section =~ /^all$/i ? @content.clone : @content.in_section(section)
668
673
  end
669
674
 
670
- opt[:time_filter] = [nil, nil]
671
- if opt[:from] && !opt[:date_filter]
672
- if opt[:from][0].is_a?(String) && opt[:from][0] =~ time_rx
673
- opt[:time_filter] = opt[:from]
674
- elsif opt[:from][0].is_a?(Time)
675
- opt[:date_filter] = opt[:from]
675
+ if !opt[:time_filter]
676
+ opt[:time_filter] = [nil, nil]
677
+ if opt[:from] && !opt[:date_filter]
678
+ if opt[:from][0].is_a?(String) && opt[:from][0] =~ time_rx
679
+ opt[:time_filter] = opt[:from]
680
+ elsif opt[:from][0].is_a?(Time)
681
+ opt[:date_filter] = opt[:from]
682
+ end
676
683
  end
677
684
  end
678
685
 
@@ -1255,7 +1262,7 @@ module Doing
1255
1262
  removed = []
1256
1263
 
1257
1264
  if opt[:autotag]
1258
- new_title = autotag(item.title) if @auto_tag
1265
+ new_title = autotag(item.title) if Doing.auto_tag
1259
1266
  if new_title == item.title
1260
1267
  logger.count(:skipped, level: :debug, message: '%count unchaged %items')
1261
1268
  # logger.debug('Autotag:', 'No changes')
@@ -1653,6 +1660,7 @@ module Doing
1653
1660
  opt[:tag_order] ||= :asc
1654
1661
  opt[:tags_color] = cfg['tags_color'] || false if opt[:tags_color].nil?
1655
1662
  opt[:template] ||= cfg['template']
1663
+ opt[:sort_tags] ||= opt[:tag_sort]
1656
1664
 
1657
1665
  # opt[:highlight] ||= true
1658
1666
  title = ''
@@ -1768,6 +1776,7 @@ module Doing
1768
1776
  from: opt[:from],
1769
1777
  format: cfg['date_format'],
1770
1778
  interval_format: opt[:interval_format],
1779
+ only_timed: opt[:only_timed],
1771
1780
  order: cfg['order'] || :asc,
1772
1781
  output: output,
1773
1782
  section: opt[:section],
@@ -1800,19 +1809,19 @@ module Doing
1800
1809
  # :date_filter expects an array with start and end date
1801
1810
  dates = dates.split_date_range if dates.instance_of?(String)
1802
1811
 
1803
- list_section({
1804
- section: section,
1805
- count: 0,
1806
- order: :asc,
1807
- date_filter: dates,
1808
- times: times,
1809
- output: output,
1810
- totals: opt[:totals],
1811
- duration: opt[:duration],
1812
- sort_tags: opt[:sort_tags],
1813
- template: opt[:template],
1814
- config_template: opt[:config_template]
1815
- })
1812
+ opt[:section] = section
1813
+ opt[:count] = 0
1814
+ opt[:order] = :asc
1815
+ opt[:date_filter] = dates
1816
+ opt[:times] = times
1817
+ opt[:output] = output
1818
+
1819
+ time_rx = /^(\d{1,2}+(:\d{1,2}+)?( *(am|pm))?|midnight|noon)$/
1820
+ if opt[:from] && opt[:from][0].is_a?(String) && opt[:from][0] =~ time_rx
1821
+ opt[:time_filter] = opt[:from]
1822
+ end
1823
+
1824
+ list_section(opt)
1816
1825
  end
1817
1826
 
1818
1827
  ##
@@ -1827,30 +1836,20 @@ module Doing
1827
1836
  opt ||= {}
1828
1837
  opt[:totals] ||= false
1829
1838
  opt[:sort_tags] ||= false
1839
+ opt[:config_template] ||= 'today'
1840
+ opt[:yesterday] = true
1841
+
1830
1842
  section = guess_section(section)
1831
1843
  y = (Time.now - (60 * 60 * 24)).strftime('%Y-%m-%d')
1832
1844
  opt[:after] = "#{y} #{opt[:after]}" if opt[:after]
1833
1845
  opt[:before] = "#{y} #{opt[:before]}" if opt[:before]
1834
1846
 
1835
- options = {
1836
- after: opt[:after],
1837
- before: opt[:before],
1838
- count: 0,
1839
- duration: opt[:duration],
1840
- from: opt[:from],
1841
- order: opt[:order],
1842
- output: output,
1843
- section: section,
1844
- sort_tags: opt[:sort_tags],
1845
- tag_order: opt[:tag_order],
1846
- times: times,
1847
- totals: opt[:totals],
1848
- yesterday: true,
1849
- config_template: opt[:config_template] || 'today',
1850
- template: opt[:template]
1851
- }
1847
+ opt[:output] = output
1848
+ opt[:section] = section
1849
+ opt[:times] = times
1850
+ opt[:count] = 0
1852
1851
 
1853
- list_section(options)
1852
+ list_section(opt)
1854
1853
  end
1855
1854
 
1856
1855
  ##
@@ -1947,7 +1946,7 @@ module Doing
1947
1946
  ##
1948
1947
  def autotag(string)
1949
1948
  return unless string
1950
- return string unless @auto_tag
1949
+ return string unless Doing.auto_tag
1951
1950
 
1952
1951
  original = string.dup
1953
1952
  text = string.dup
@@ -2250,6 +2249,7 @@ EOTAIL
2250
2249
  output = @other_content_top ? "#{@other_content_top.join("\n")}\n" : ''
2251
2250
  was_color = Color.coloring?
2252
2251
  Color.coloring = false
2252
+ @content.dedup!(match_section: true)
2253
2253
  output += @content.to_s
2254
2254
  output += @other_content_bottom.join("\n") unless @other_content_bottom.nil?
2255
2255
  # Just strip all ANSI colors from the content before writing to doing file
data/lib/doing.rb CHANGED
@@ -22,7 +22,6 @@ require 'tty-which'
22
22
  require 'tty-markdown'
23
23
  require 'tty-reader'
24
24
  require 'tty-screen'
25
- require 'sys-uname'
26
25
 
27
26
  require_relative 'doing/changelog'
28
27
  require_relative 'doing/hash'
@@ -42,7 +41,7 @@ require_relative 'doing/items'
42
41
  require_relative 'doing/note'
43
42
  require_relative 'doing/item'
44
43
  require_relative 'doing/wwid'
45
- require_relative 'doing/log_adapter'
44
+ require_relative 'doing/logger'
46
45
  require_relative 'doing/prompt'
47
46
  require_relative 'doing/errors'
48
47
  require_relative 'doing/hooks'
@@ -57,13 +56,14 @@ require_relative 'doing/chronify/chronify'
57
56
  # Main doing module
58
57
  module Doing
59
58
  class << self
59
+ attr_accessor :auto_tag
60
60
  #
61
61
  # Fetch the logger
62
62
  #
63
- # @return the LogAdapter instance.
63
+ # @return the Logger instance.
64
64
  #
65
65
  def logger
66
- @logger ||= LogAdapter.new((ENV['DOING_LOG_LEVEL'] || :info).to_sym)
66
+ @logger ||= Logger.new((ENV['DOING_LOG_LEVEL'] || :info).to_sym)
67
67
  end
68
68
 
69
69
  ##
@@ -33,7 +33,7 @@ module Doing
33
33
  raise InvalidArgument, 'Path is not a directory' unless File.directory?(path)
34
34
 
35
35
  options[:no_overlap] ||= false
36
- options[:autotag] ||= wwid.auto_tag
36
+ options[:autotag] ||= Doing.auto_tag
37
37
 
38
38
  tags = options[:tag] ? options[:tag].split(/[ ,]+/).map { |t| t.sub(/^@?/, '') } : []
39
39
  options[:tag] = nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doing
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.33
4
+ version: 2.1.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-18 00:00:00.000000000 Z
11
+ date: 2022-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: github-markup
@@ -292,26 +292,6 @@ dependencies:
292
292
  - - "~>"
293
293
  - !ruby/object:Gem::Version
294
294
  version: '1.0'
295
- - !ruby/object:Gem::Dependency
296
- name: sys-uname
297
- requirement: !ruby/object:Gem::Requirement
298
- requirements:
299
- - - "~>"
300
- - !ruby/object:Gem::Version
301
- version: '1.2'
302
- - - ">="
303
- - !ruby/object:Gem::Version
304
- version: 1.2.2
305
- type: :runtime
306
- prerelease: false
307
- version_requirements: !ruby/object:Gem::Requirement
308
- requirements:
309
- - - "~>"
310
- - !ruby/object:Gem::Version
311
- version: '1.2'
312
- - - ">="
313
- - !ruby/object:Gem::Version
314
- version: 1.2.2
315
295
  - !ruby/object:Gem::Dependency
316
296
  name: tty-link
317
297
  requirement: !ruby/object:Gem::Requirement
@@ -458,7 +438,6 @@ files:
458
438
  - Rakefile
459
439
  - _config.yml
460
440
  - bash_profile
461
- - bin/commands/add_section.rb
462
441
  - bin/commands/again.rb
463
442
  - bin/commands/archive.rb
464
443
  - bin/commands/cancel.rb
@@ -527,6 +506,7 @@ files:
527
506
  - docs/doc/Doing/Item.html
528
507
  - docs/doc/Doing/Items.html
529
508
  - docs/doc/Doing/LogAdapter.html
509
+ - docs/doc/Doing/Logger.html
530
510
  - docs/doc/Doing/Note.html
531
511
  - docs/doc/Doing/Pager.html
532
512
  - docs/doc/Doing/Plugins.html
@@ -614,7 +594,7 @@ files:
614
594
  - lib/doing/hooks.rb
615
595
  - lib/doing/item.rb
616
596
  - lib/doing/items.rb
617
- - lib/doing/log_adapter.rb
597
+ - lib/doing/logger.rb
618
598
  - lib/doing/markdown_document_listener.rb
619
599
  - lib/doing/normalize.rb
620
600
  - lib/doing/note.rb
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # @@add_section
4
- desc 'Add a new section to the "doing" file'
5
- arg_name 'SECTION_NAME'
6
- command :add_section do |c|
7
- c.example 'doing add_section Ideas', desc: 'Add a section called Ideas to the doing file'
8
-
9
- c.action do |_global_options, _options, args|
10
- raise InvalidArgument, "Section #{args[0]} already exists" if @wwid.sections.include?(args[0])
11
-
12
- @wwid.content.add_section(args.join(' ').cap_first, log: true)
13
- @wwid.write(@wwid.doing_file)
14
- end
15
- end