doing 2.1.31pre → 2.1.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +58 -1
  3. data/Dockerfile-2.6 +3 -1
  4. data/Dockerfile-2.7 +4 -2
  5. data/Dockerfile-3.0 +3 -1
  6. data/Gemfile.lock +1 -71
  7. data/README.md +1 -1
  8. data/bash_profile +13 -0
  9. data/bin/commands/config.rb +16 -13
  10. data/bin/commands/done.rb +1 -1
  11. data/bin/commands/grep.rb +2 -29
  12. data/bin/commands/meanwhile.rb +1 -1
  13. data/bin/commands/now.rb +1 -1
  14. data/bin/commands/on.rb +6 -16
  15. data/bin/commands/open.rb +2 -2
  16. data/bin/commands/recent.rb +2 -14
  17. data/bin/commands/rotate.rb +17 -0
  18. data/bin/commands/sections.rb +82 -7
  19. data/bin/commands/show.rb +1 -21
  20. data/bin/commands/since.rb +5 -16
  21. data/bin/commands/tag_dir.rb +27 -3
  22. data/bin/commands/today.rb +3 -28
  23. data/bin/commands/yesterday.rb +2 -35
  24. data/bin/doing +9 -8
  25. data/docs/doc/Array.html +1 -1
  26. data/docs/doc/BooleanTermParser/Clause.html +1 -1
  27. data/docs/doc/BooleanTermParser/Operator.html +1 -1
  28. data/docs/doc/BooleanTermParser/Query.html +1 -1
  29. data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
  30. data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
  31. data/docs/doc/BooleanTermParser.html +1 -1
  32. data/docs/doc/Doing/Color.html +1 -1
  33. data/docs/doc/Doing/Completion.html +1 -1
  34. data/docs/doc/Doing/Configuration.html +3 -3
  35. data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
  36. data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
  37. data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
  38. data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
  39. data/docs/doc/Doing/Errors/NoResults.html +1 -1
  40. data/docs/doc/Doing/Errors/PluginException.html +1 -1
  41. data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
  42. data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
  43. data/docs/doc/Doing/Errors.html +1 -1
  44. data/docs/doc/Doing/Hooks.html +1 -1
  45. data/docs/doc/Doing/Item.html +20 -3
  46. data/docs/doc/Doing/Items.html +209 -1
  47. data/docs/doc/Doing/LogAdapter.html +1 -1
  48. data/docs/doc/Doing/Logger.html +1807 -0
  49. data/docs/doc/Doing/Note.html +1 -1
  50. data/docs/doc/Doing/Pager.html +1 -1
  51. data/docs/doc/Doing/Plugins.html +1 -1
  52. data/docs/doc/Doing/Prompt.html +1 -1
  53. data/docs/doc/Doing/Section.html +1 -1
  54. data/docs/doc/Doing/TemplateString.html +1 -1
  55. data/docs/doc/Doing/Types.html +3 -3
  56. data/docs/doc/Doing/Util/Backup.html +1 -1
  57. data/docs/doc/Doing/Util.html +1 -1
  58. data/docs/doc/Doing/WWID.html +3 -53
  59. data/docs/doc/Doing.html +4 -4
  60. data/docs/doc/FalseClass.html +1 -1
  61. data/docs/doc/GLI/Commands/Help.html +1 -1
  62. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  63. data/docs/doc/GLI/Commands.html +1 -1
  64. data/docs/doc/GLI.html +1 -1
  65. data/docs/doc/Hash.html +1 -1
  66. data/docs/doc/Object.html +1 -1
  67. data/docs/doc/PhraseParser/Operator.html +1 -1
  68. data/docs/doc/PhraseParser/PhraseClause.html +1 -1
  69. data/docs/doc/PhraseParser/Query.html +1 -1
  70. data/docs/doc/PhraseParser/QueryParser.html +1 -1
  71. data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
  72. data/docs/doc/PhraseParser/TermClause.html +1 -1
  73. data/docs/doc/PhraseParser.html +1 -1
  74. data/docs/doc/Status.html +1 -1
  75. data/docs/doc/String.html +1 -1
  76. data/docs/doc/Symbol.html +1 -1
  77. data/docs/doc/Time.html +1 -1
  78. data/docs/doc/TrueClass.html +1 -1
  79. data/docs/doc/_index.html +10 -10
  80. data/docs/doc/class_list.html +1 -1
  81. data/docs/doc/file.README.html +2 -2
  82. data/docs/doc/index.html +2 -2
  83. data/docs/doc/method_list.html +407 -383
  84. data/docs/doc/top-level-namespace.html +1 -1
  85. data/docs/index.md +1 -1
  86. data/doing.gemspec +23 -24
  87. data/doing.rdoc +235 -18
  88. data/inputrc +57 -0
  89. data/lib/completion/_doing.zsh +47 -51
  90. data/lib/completion/doing.bash +12 -23
  91. data/lib/completion/doing.fish +39 -12
  92. data/lib/doing/add_options.rb +36 -1
  93. data/lib/doing/changelog/changes.rb +1 -1
  94. data/lib/doing/chronify/string.rb +1 -1
  95. data/lib/doing/completion/bash_completion.rb +1 -1
  96. data/lib/doing/completion/fish_completion.rb +2 -2
  97. data/lib/doing/completion/zsh_completion.rb +10 -4
  98. data/lib/doing/configuration.rb +7 -1
  99. data/lib/doing/item.rb +9 -2
  100. data/lib/doing/items.rb +48 -0
  101. data/lib/doing/{log_adapter.rb → logger.rb} +8 -2
  102. data/lib/doing/plugins/import/calendar_import.rb +1 -1
  103. data/lib/doing/plugins/import/doing_import.rb +1 -1
  104. data/lib/doing/plugins/import/timing_import.rb +1 -1
  105. data/lib/doing/string/tags.rb +1 -1
  106. data/lib/doing/types.rb +2 -2
  107. data/lib/doing/version.rb +1 -1
  108. data/lib/doing/wwid.rb +43 -43
  109. data/lib/doing.rb +4 -4
  110. data/lib/examples/plugins/capture_thing_import.rb +1 -1
  111. data/lib/helpers/threaded_tests.rb +2 -0
  112. metadata +101 -138
  113. data/.yardoc/checksums +0 -30
  114. data/.yardoc/complete +0 -0
  115. data/.yardoc/object_types +0 -0
  116. data/.yardoc/objects/root.dat +0 -0
  117. data/.yardoc/proxy_types +0 -0
  118. 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
@@ -82,6 +82,7 @@ class ThreadedTests
82
82
  @running_tests = []
83
83
 
84
84
  begin
85
+ finish_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
85
86
  while @children.count.positive?
86
87
 
87
88
  slices = @children.slice!(0, max_threads)
@@ -89,6 +90,7 @@ class ThreadedTests
89
90
  slices.each do |s|
90
91
  @threads << Thread.new do
91
92
  run_test(s)
93
+ finish_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
92
94
  end
93
95
  end
94
96