doing 2.1.22 → 2.1.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.yardoc/checksums +13 -11
  3. data/.yardoc/object_types +0 -0
  4. data/.yardoc/objects/root.dat +0 -0
  5. data/CHANGELOG.md +18 -10
  6. data/Gemfile.lock +1 -1
  7. data/README.md +1 -1
  8. data/bin/doing +134 -27
  9. data/docs/doc/Array.html +10 -5
  10. data/docs/doc/BooleanTermParser/Clause.html +1 -1
  11. data/docs/doc/BooleanTermParser/Operator.html +1 -1
  12. data/docs/doc/BooleanTermParser/Query.html +1 -1
  13. data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
  14. data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
  15. data/docs/doc/BooleanTermParser.html +1 -1
  16. data/docs/doc/Doing/Color.html +1 -1
  17. data/docs/doc/Doing/Completion.html +1 -1
  18. data/docs/doc/Doing/Configuration.html +3 -3
  19. data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
  20. data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
  21. data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
  22. data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
  23. data/docs/doc/Doing/Errors/NoResults.html +1 -1
  24. data/docs/doc/Doing/Errors/PluginException.html +1 -1
  25. data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
  26. data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
  27. data/docs/doc/Doing/Errors.html +1 -1
  28. data/docs/doc/Doing/Hooks.html +1 -1
  29. data/docs/doc/Doing/Item.html +1 -1
  30. data/docs/doc/Doing/Items.html +1 -1
  31. data/docs/doc/Doing/LogAdapter.html +1 -1
  32. data/docs/doc/Doing/Note.html +1 -1
  33. data/docs/doc/Doing/Pager.html +1 -1
  34. data/docs/doc/Doing/Plugins.html +1 -1
  35. data/docs/doc/Doing/Prompt.html +1 -1
  36. data/docs/doc/Doing/Section.html +1 -1
  37. data/docs/doc/Doing/TemplateString.html +2 -2
  38. data/docs/doc/Doing/Types.html +201 -0
  39. data/docs/doc/Doing/Util/Backup.html +1 -1
  40. data/docs/doc/Doing/Util.html +2 -5
  41. data/docs/doc/Doing/WWID.html +1 -1
  42. data/docs/doc/Doing.html +2 -2
  43. data/docs/doc/GLI/Commands/Help.html +185 -0
  44. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  45. data/docs/doc/GLI/Commands.html +5 -3
  46. data/docs/doc/GLI.html +4 -2
  47. data/docs/doc/Hash.html +3 -11
  48. data/docs/doc/Numeric.html +1 -1
  49. data/docs/doc/PhraseParser/Operator.html +1 -1
  50. data/docs/doc/PhraseParser/PhraseClause.html +1 -1
  51. data/docs/doc/PhraseParser/Query.html +1 -1
  52. data/docs/doc/PhraseParser/QueryParser.html +1 -1
  53. data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
  54. data/docs/doc/PhraseParser/TermClause.html +1 -1
  55. data/docs/doc/PhraseParser.html +1 -1
  56. data/docs/doc/Status.html +1 -1
  57. data/docs/doc/String.html +40 -10
  58. data/docs/doc/Symbol.html +1 -1
  59. data/docs/doc/Time.html +1 -1
  60. data/docs/doc/_index.html +16 -9
  61. data/docs/doc/class_list.html +1 -1
  62. data/docs/doc/file.README.html +2 -2
  63. data/docs/doc/index.html +2 -2
  64. data/docs/doc/method_list.html +160 -144
  65. data/docs/doc/top-level-namespace.html +1 -1
  66. data/docs/index.md +1 -1
  67. data/doing.rdoc +148 -4
  68. data/lib/completion/_doing.zsh +15 -15
  69. data/lib/completion/doing.bash +29 -18
  70. data/lib/completion/doing.fish +21 -1
  71. data/lib/doing/array.rb +2 -2
  72. data/lib/doing/changelog/change.rb +115 -0
  73. data/lib/doing/changelog/changes.rb +73 -0
  74. data/lib/doing/changelog/entry.rb +21 -0
  75. data/lib/doing/changelog/version.rb +97 -0
  76. data/lib/doing/changelog.rb +6 -0
  77. data/lib/doing/configuration.rb +15 -7
  78. data/lib/doing/hash.rb +3 -2
  79. data/lib/doing/help_monkey_patch.rb +31 -0
  80. data/lib/doing/hooks.rb +5 -1
  81. data/lib/doing/item.rb +10 -25
  82. data/lib/doing/plugins/export/template_export.rb +1 -1
  83. data/lib/doing/string.rb +19 -10
  84. data/lib/doing/string_chronify.rb +1 -1
  85. data/lib/doing/types.rb +2 -0
  86. data/lib/doing/util.rb +2 -1
  87. data/lib/doing/version.rb +1 -1
  88. data/lib/doing/wwid.rb +22 -19
  89. data/lib/doing.rb +1 -0
  90. data/lib/helpers/threaded_tests.rb +14 -1
  91. metadata +10 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09c53ca468f428a8f5a77060bf395707dace911e06213a00a8e0fe54c03abc38'
4
- data.tar.gz: 9226dc60c9a2ef22f278e147dd95693b36a01fd4b7df4f0c211c747b21ceaf8c
3
+ metadata.gz: fdf598d8593e25aa531d1ec02b0e69f590788c62aa6705f34a46bed79d6148ec
4
+ data.tar.gz: 21ef0574c7fb02deb54a2e5223c9f682b8409c41363cde8514c609a6f720fb41
5
5
  SHA512:
6
- metadata.gz: 80ecd2f1fe4801b82546ecaf3eb9c6028ac27aa424b77ca0fe7f68d06a240c5670f02e989c228b21270bdb4f3f49e8f7c0dad17901aa9fe90dac6b45e0885fe1
7
- data.tar.gz: 7e8bef046989f6a3fb5293104f70db7368632488847aff9e4f9a8f1166c399db1df92c773cbbf9a5166c74a40737e1fd016ecfadea9e8ca01e5dda7f278dbf33
6
+ metadata.gz: 0fafb344357db4cc254a10428ba5104a1973fc9fdf437b0fcd96bad8c87538706ed2e3d7517505d3c5e4c23326e0f46e77fca334fcc01fecff2e192498b770bc
7
+ data.tar.gz: 6a8a6d5d0b5e25648d23f913232e7adbb9f602e0df52e6280e0efb71e07051e8a43aa30bba67a7e11fbbece7f29394e351828a4edb9e8e15cea5483548a0cf06
data/.yardoc/checksums CHANGED
@@ -1,31 +1,33 @@
1
- lib/doing/hash.rb 4c08dd246aa0ced651a1568832cea1a91a984eb6
2
- lib/doing/item.rb ffccadf4b6e9e48373a954ad4b690e9c31dfd2cb
1
+ lib/doing/hash.rb 48b7ed855f33b2f10b4be41b09cee1efcb855b4b
2
+ lib/doing/item.rb b508a3da515f86981b30d61083e0dbb8549f894c
3
3
  lib/doing/note.rb bbadd9e34e6dc43a2af1110a5107f46c39d2547f
4
4
  lib/doing/time.rb 60183c3c31532ffea1440c766de0f90042e0fd10
5
- lib/doing/util.rb 33ad79455893213a0f2993edec0e158526657f09
6
- lib/doing/wwid.rb f28e9675a5c1014452f441e26048375cf127b714
7
- lib/doing/array.rb c459e484f121abd64c8b3877a447ec7b6a65f9bc
8
- lib/doing/hooks.rb acf6e0615ccf1949f84915c979297845242c1205
5
+ lib/doing/util.rb 170f0eb8ac4cb0f47d517eb6a87f94850b7f1f41
6
+ lib/doing/wwid.rb 0c879394cb2ae617bda567b00dab17ff0b3c8254
7
+ lib/doing/array.rb b50c4604cb685dff87bc16bc20f21a5956b2b396
8
+ lib/doing/hooks.rb 9ffc1f719b06b18d64e548f52f7d2eaf6c21b06a
9
9
  lib/doing/items.rb 69c762d337d9dad2b780cd08cc1c8785310e23ba
10
10
  lib/doing/pager.rb a5dc55e1163d1b8476617e924a3aee4f9bf8be00
11
- lib/doing/types.rb a53694ca64c613263b26b7a980c450abc2477242
11
+ lib/doing/types.rb eed3ee1071ffa4a2f9caf50beb7523a24146cd1d
12
12
  lib/doing/colors.rb b7239a69e10c5df9378a5843441af5b93c1872f8
13
13
  lib/doing/errors.rb af07e482a5389924edc2337749c81cda501098f0
14
14
  lib/doing/prompt.rb d241935b209e69a14c55a9c3a035f1751c576b4c
15
- lib/doing/string.rb ae82fc6e60a490bfb30b5913390d1d375451fe69
15
+ lib/doing/string.rb 443e238f1c4e205a61734b4be3d22f41388e9713
16
16
  lib/doing/symbol.rb 309799458a1bc715c2707307c9a62ab26086275e
17
17
  lib/doing/section.rb 206e119cf818f1e76798753e611180fe77bc299a
18
- lib/doing/version.rb 02268018a64ba45e346d12dd6fc027f6cc68e2d3
18
+ lib/doing/version.rb 21027627e64f35ac455dee6dd8565e6af062ddbb
19
+ lib/doing/changelog.rb f7d1bd424e63400ab0613ef3358e614fdf53e2b5
19
20
  lib/doing/cli_status.rb dbedd454c4cbbd0fed9ef30120f6ec85d18b9356
20
21
  lib/doing/completion.rb c658e7dc7898fb022a21b2bd77bedb958ca3b067
21
22
  lib/doing/log_adapter.rb 62ee66981878bd7285ccf0dfeca90a3d6d2af985
22
23
  lib/doing/util_backup.rb c13f71072581b1f0d2269853611ba09273261bf9
23
- lib/doing/configuration.rb d9b945a608452cdacb3f92ba711a83b4fecbb795
24
+ lib/doing/configuration.rb 26c86add1bf9ab00bec24ba0c01774b5617fe2d9
24
25
  lib/doing/phrase_parser.rb 8f1789d7cf8326d8cc231b4a21505a93f8de20d2
25
26
  lib/doing/array_chronify.rb b39b40268b1751b18acf6bae4e53885818e45f62
26
27
  lib/doing/plugin_manager.rb cb16a82c3182ef7008359670ab96ff6b39270ccc
27
- lib/doing/string_chronify.rb 79d3926e586b2ddeef508d778f76c777bc4ee811
28
+ lib/doing/string_chronify.rb 888afa2175f3bb6cac0d68e3cb0f27cf162bb1bf
28
29
  lib/doing/template_string.rb 736f6e7645160f75061db1856a62101238fe8c56
29
30
  lib/doing/numeric_chronify.rb bedeff62a95f8a8ff116e1bf0cc1d9eb2707a900
31
+ lib/doing/help_monkey_patch.rb 6aa514c249e519db507ae528de2604c18cc36045
30
32
  lib/doing/boolean_term_parser.rb 075977892ac5c6e3435cb8877d8b8b68eb1962e3
31
33
  lib/doing/markdown_document_listener.rb 45485f225068a34951ec818a345f642323e5ba35
data/.yardoc/object_types CHANGED
Binary file
Binary file
data/CHANGELOG.md CHANGED
@@ -1,20 +1,28 @@
1
- ### 2.1.22
1
+ ### 2.1.23
2
+
3
+ 2022-01-22 15:52
4
+
5
+ #### NEW
2
6
 
3
- 2022-01-21 14:39
7
+ - All display commands (except view) now accept `--config_template TEMPLATE_KEY` to override that commands default template.
8
+ - Display commands accept `--template`, which takes a template string containing %placeholders and overrides the commands default template output. Affects grep, last, on, recent, show, since, today, yesterday
4
9
 
5
10
  #### IMPROVED
6
11
 
7
- - General improvements to `doing note`, including better handling of piping notes from STDIN, using a Readline input unless `--editor` is specified, changed order of importance for different inputs
8
- - `doing reset -n` switch is a shortcut for `--no-resume` to avoid removing @done when modifying a start date
9
- - More duration formats available for config (clock, dhm, hm, m, natural)
12
+ - With complete examples in the help output for most commands, `doing help` almost always requires scrolling up. It now automatically paginates using your system $PAGER (or best detected option). # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # On branch develop # Your branch is up to date with 'origin/develop'. # # Changes to be committed: # modified: lib/doing.rb # new file: lib/doing/help_monkey_patch.rb # # ------------------------ >8 ------------------------ # Do not modify or remove the line above. # Everything below it will be ignored. diff --git a/lib/doing.rb b/lib/doing.rb index d29e6ab..87a47b8 100644 --- a/lib/doing.rb +++ b/lib/doing.rb @@ -23,6 +23,7 @@ require 'tty-markdown' require 'tty-reader' require 'tty-screen' +require_relative 'doing/help_monkey_patch' require_relative 'doing/changelog' require_relative 'doing/hash' require_relative 'doing/types' diff --git a/lib/doing/help_monkey_patch.rb b/lib/doing/help_monkey_patch.rb new file mode 100644 index 0000000..5a20288 --- /dev/null +++ b/lib/doing/help_monkey_patch.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module GLI + module Commands + # Help Command Monkeypatch for paginated output + class Help < Command + def show_help(global_options,options,arguments,out,error) + Doing::Pager.paginate = true + + command_finder = HelpModules::CommandFinder.new(@app,arguments,error) + if options[:c] + help_output = HelpModules::HelpCompletionFormat.new(@app,command_finder,arguments).format + out.puts help_output unless help_output.nil? + elsif arguments.empty? || options[:c] + Doing::Pager.page HelpModules::GlobalHelpFormat.new(@app,@sorter,@text_wrapping_class).format + else + name = arguments.shift + command = command_finder.find_command(name) + unless command.nil? + Doing::Pager.page HelpModules::CommandHelpFormat.new( + command, + @app, + @sorter, + @synopsis_formatter_class, + @text_wrapping_class).format + end + end + end + end + end +end
13
+ - `doing tags` takes a MAX_COUNT argument to limit results when searching
14
+ - `doing tags --line` flag to output tags in a single line
15
+ - Mostly for my own use, `doing changes` (which views the changelog) now accepts `--lookup VERSION` and `--search SEARCH_PATTERN`
16
+ - `doing changes --lookup` accepts `"< 2.1 > 2.0"`, `"2.1.10-2.2"`, a specific version, or a version number with wildcards
17
+ - When registering hooks, you can pass an array to register a block for multiple events, assuming the events provide the same block arguments (like post_entry_added and post_entry_updated)
10
18
 
11
19
  #### FIXED
12
20
 
13
- - Fix already initialized warning
14
- - Don't invoke Readline inputs when the current device is not a TTY
15
- - View keys being overridden by template keys
16
- - Tag string routines
17
- - Error handling additional configs when a config file is specified on command line
21
+ - Running `--tag "@doing"` wouldn't work where `--tag "doing"` would. Now properly ignoring @ symbols
22
+
23
+ ### 2.1.22
24
+
25
+ 2022-01-21 14:53
18
26
 
19
27
  ### 2.1.21
20
28
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- doing (2.1.22)
4
+ doing (2.1.23)
5
5
  chronic (~> 0.10, >= 0.10.2)
6
6
  deep_merge (~> 1.2, >= 1.2.1)
7
7
  gli (~> 2.20, >= 2.20.1)
data/README.md CHANGED
@@ -8,7 +8,7 @@ _If you're one of the rare people like me who find this useful, feel free to
8
8
 
9
9
  <!--README-->
10
10
 
11
- The current version of `doing` is <!--VER-->2.1.21<!--END VER-->.
11
+ The current version of `doing` is <!--VER-->2.1.22<!--END VER-->.
12
12
 
13
13
  Find all of the documentation in the [doing wiki][wiki].
14
14
 
data/bin/doing CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  $LOAD_PATH.unshift File.join(__dir__, '..', 'lib')
5
5
  require 'gli'
6
+ require 'doing/help_monkey_patch'
6
7
  require 'doing'
7
8
  require 'tempfile'
8
9
  require 'pp'
@@ -21,6 +22,7 @@ end
21
22
 
22
23
  include GLI::App
23
24
  include Doing::Errors
25
+
24
26
  version Doing::VERSION
25
27
  hide_commands_without_desc true
26
28
  autocomplete_commands true
@@ -65,6 +67,13 @@ if settings.dig('plugins', 'command_path')
65
67
  commands_from File.expand_path(settings.dig('plugins', 'command_path'))
66
68
  end
67
69
 
70
+ accept TemplateName do |value|
71
+ res = settings['templates'].keys.select { |k| k =~ value.to_rx(distance: 2) }
72
+ raise InvalidArgument, "Unknown template: #{value}" if res.empty?
73
+
74
+ res.group_by(&:length).min.last[0]
75
+ end
76
+
68
77
  accept DateBeginString do |value|
69
78
  if value =~ REGEX_TIME
70
79
  res = value
@@ -1682,6 +1691,14 @@ command %i[grep search] do |c|
1682
1691
  c.arg_name 'FORMAT'
1683
1692
  c.flag %i[o output]
1684
1693
 
1694
+ c.desc "Output using a template from configuration"
1695
+ c.arg_name 'TEMPLATE_KEY'
1696
+ c.flag [:config_template], type: TemplateName, default_value: 'default'
1697
+
1698
+ c.desc 'Override output format with a template string containing %placeholders'
1699
+ c.arg_name 'TEMPLATE_STRING'
1700
+ c.flag [:template]
1701
+
1685
1702
  c.desc 'Show time intervals on @done tasks'
1686
1703
  c.switch %i[t times], default_value: true, negatable: true
1687
1704
 
@@ -1736,7 +1753,7 @@ command %i[grep search] do |c|
1736
1753
  options[:fuzzy] = false
1737
1754
  raise DoingRuntimeError, %(Invalid output type "#{options[:output]}") if options[:output] && options[:output] !~ Doing::Plugins.plugin_regex(type: :export)
1738
1755
 
1739
- template = settings['templates']['default'].deep_merge(settings)
1756
+ template = settings['templates'][options[:config_template]].deep_merge(settings)
1740
1757
  tags_color = template.key?('tags_color') ? template['tags_color'] : nil
1741
1758
 
1742
1759
  section = wwid.guess_section(options[:section]) if options[:section]
@@ -1793,6 +1810,14 @@ command :last do |c|
1793
1810
  c.arg_name 'QUERY'
1794
1811
  c.flag [:search]
1795
1812
 
1813
+ c.desc "Output using a template from configuration"
1814
+ c.arg_name 'TEMPLATE_KEY'
1815
+ c.flag [:config_template], type: TemplateName, default_value: 'last'
1816
+
1817
+ c.desc 'Override output format with a template string containing %placeholders'
1818
+ c.arg_name 'TEMPLATE_STRING'
1819
+ c.flag [:template]
1820
+
1796
1821
  c.desc "Highlight search matches in output. Only affects command line output"
1797
1822
  c.switch %i[h hilite], default_value: settings.dig('search', 'highlight')
1798
1823
 
@@ -1846,6 +1871,8 @@ command :last do |c|
1846
1871
  else
1847
1872
  last = wwid.last(times: true, section: options[:section],
1848
1873
  options: {
1874
+ config_template: options[:config_template],
1875
+ template: options[:template],
1849
1876
  duration: options[:duration],
1850
1877
  search: options[:search],
1851
1878
  fuzzy: options[:fuzzy],
@@ -1880,6 +1907,14 @@ command :recent do |c|
1880
1907
  c.desc 'Show time intervals on @done tasks'
1881
1908
  c.switch %i[t times], default_value: true, negatable: true
1882
1909
 
1910
+ c.desc "Output using a template from configuration"
1911
+ c.arg_name 'TEMPLATE_KEY'
1912
+ c.flag [:config_template], type: TemplateName, default_value: 'recent'
1913
+
1914
+ c.desc 'Override output format with a template string containing %placeholders'
1915
+ c.arg_name 'TEMPLATE_STRING'
1916
+ c.flag [:template]
1917
+
1883
1918
  c.desc 'Show elapsed time on entries without @done tag'
1884
1919
  c.switch [:duration]
1885
1920
 
@@ -1923,7 +1958,9 @@ command :recent do |c|
1923
1958
  times: options[:times],
1924
1959
  totals: options[:totals],
1925
1960
  interactive: options[:interactive],
1926
- duration: options[:duration]
1961
+ duration: options[:duration],
1962
+ config_template: options[:config_template],
1963
+ template: options[:template]
1927
1964
  }
1928
1965
 
1929
1966
  Doing::Pager::page wwid.recent(count, section.cap_first, opts)
@@ -2038,6 +2075,14 @@ command :show do |c|
2038
2075
  c.desc 'Only show items with recorded time intervals'
2039
2076
  c.switch [:only_timed], default_value: false, negatable: false
2040
2077
 
2078
+ c.desc "Output using a template from configuration"
2079
+ c.arg_name 'TEMPLATE_KEY'
2080
+ c.flag [:config_template], type: TemplateName, default_value: 'default'
2081
+
2082
+ c.desc 'Override output format with a template string containing %placeholders'
2083
+ c.arg_name 'TEMPLATE_STRING'
2084
+ c.flag [:template]
2085
+
2041
2086
  c.desc 'Select section or tag to display from a menu'
2042
2087
  c.switch %i[m menu], negatable: false, default_value: false
2043
2088
 
@@ -2094,7 +2139,7 @@ command :show do |c|
2094
2139
 
2095
2140
  options[:times] = true if options[:totals]
2096
2141
 
2097
- template = settings['templates']['default'].deep_merge({
2142
+ template = settings['templates'][options[:config_template]].deep_merge({
2098
2143
  'wrap_width' => settings['wrap_width'] || 0,
2099
2144
  'date_format' => settings['default_date_format'],
2100
2145
  'order' => settings['order'] || 'asc',
@@ -2158,6 +2203,7 @@ end
2158
2203
 
2159
2204
  # @@tags
2160
2205
  desc 'List all tags in the current Doing file'
2206
+ arg_name 'MAX_COUNT', optional: true, type: Integer
2161
2207
  command :tags do |c|
2162
2208
  c.desc 'Section'
2163
2209
  c.arg_name 'SECTION_NAME'
@@ -2166,6 +2212,9 @@ command :tags do |c|
2166
2212
  c.desc 'Show count of occurrences'
2167
2213
  c.switch %i[c counts]
2168
2214
 
2215
+ c.desc 'Output in a single line with @ symbols. Ignored if --counts is specified.'
2216
+ c.switch %i[l line]
2217
+
2169
2218
  c.desc 'Sort by name or count'
2170
2219
  c.arg_name 'SORT_ORDER'
2171
2220
  c.flag %i[sort], default_value: 'name', must_match: /^(?:n(?:ame)?|c(?:ount)?)$/
@@ -2209,6 +2258,7 @@ command :tags do |c|
2209
2258
 
2210
2259
  c.action do |_global, options, args|
2211
2260
  section = wwid.guess_section(options[:section]) || options[:section].cap_first
2261
+ options[:count] = args.count.positive? ? args[0].to_i : 0
2212
2262
 
2213
2263
  items = wwid.filter_items([], opt: options)
2214
2264
 
@@ -2236,7 +2286,11 @@ command :tags do |c|
2236
2286
  if options[:counts]
2237
2287
  tags.each { |t, c| puts "#{t} (#{c})" }
2238
2288
  else
2239
- tags.each { |t, c| puts "#{t}" }
2289
+ if options[:line]
2290
+ puts tags.map { |t, c| t }.to_tags.join(' ')
2291
+ else
2292
+ tags.each { |t, c| puts "#{t}" }
2293
+ end
2240
2294
  end
2241
2295
  end
2242
2296
  end
@@ -2274,6 +2328,14 @@ command :today do |c|
2274
2328
  c.arg_name 'FORMAT'
2275
2329
  c.flag %i[o output]
2276
2330
 
2331
+ c.desc "Output using a template from configuration"
2332
+ c.arg_name 'TEMPLATE_KEY'
2333
+ c.flag [:config_template], type: TemplateName, default_value: 'today'
2334
+
2335
+ c.desc 'Override output format with a template string containing %placeholders'
2336
+ c.arg_name 'TEMPLATE_STRING'
2337
+ c.flag [:template]
2338
+
2277
2339
  c.desc 'View entries before specified time (e.g. 8am, 12:30pm, 15:00)'
2278
2340
  c.arg_name 'TIME_STRING'
2279
2341
  c.flag [:before]
@@ -2293,7 +2355,7 @@ command :today do |c|
2293
2355
 
2294
2356
  options[:times] = true if options[:totals]
2295
2357
  options[:sort_tags] = options[:tag_sort] =~ /^n/i
2296
- filter_options = %i[after before duration from section sort_tags totals].each_with_object({}) { |k, hsh| hsh[k] = options[k] }
2358
+ filter_options = %i[after before duration from section sort_tags totals template config_template].each_with_object({}) { |k, hsh| hsh[k] = options[k] }
2297
2359
 
2298
2360
  Doing::Pager.page wwid.today(options[:times], options[:output], filter_options).chomp
2299
2361
  end
@@ -2333,6 +2395,14 @@ command :on do |c|
2333
2395
  c.arg_name 'FORMAT'
2334
2396
  c.flag %i[o output]
2335
2397
 
2398
+ c.desc "Output using a template from configuration"
2399
+ c.arg_name 'TEMPLATE_KEY'
2400
+ c.flag [:config_template], type: TemplateName, default_value: 'default'
2401
+
2402
+ c.desc 'Override output format with a template string containing %placeholders'
2403
+ c.arg_name 'TEMPLATE_STRING'
2404
+ c.flag [:template]
2405
+
2336
2406
  c.action do |_global_options, options, args|
2337
2407
  raise DoingRuntimeError, %(Invalid output type "#{options[:output]}") if options[:output] && options[:output] !~ Doing::Plugins.plugin_regex(type: :export)
2338
2408
 
@@ -2354,7 +2424,7 @@ command :on do |c|
2354
2424
  options[:sort_tags] = options[:tag_sort] =~ /^n/i
2355
2425
 
2356
2426
  Doing::Pager.page wwid.list_date([start, finish], options[:section], options[:times], options[:output],
2357
- { duration: options[:duration], totals: options[:totals], sort_tags: options[:sort_tags] }).chomp
2427
+ { template: options[:template], config_template: options[:config_template], duration: options[:duration], totals: options[:totals], sort_tags: options[:sort_tags] }).chomp
2358
2428
  end
2359
2429
  end
2360
2430
 
@@ -2390,6 +2460,14 @@ command :since do |c|
2390
2460
  c.arg_name 'FORMAT'
2391
2461
  c.flag %i[o output]
2392
2462
 
2463
+ c.desc "Output using a template from configuration"
2464
+ c.arg_name 'TEMPLATE_KEY'
2465
+ c.flag [:config_template], type: TemplateName, default_value: 'default'
2466
+
2467
+ c.desc 'Override output format with a template string containing %placeholders'
2468
+ c.arg_name 'TEMPLATE_STRING'
2469
+ c.flag [:template]
2470
+
2393
2471
  c.action do |_global_options, options, args|
2394
2472
  raise DoingRuntimeError, %(Invalid output type "#{options[:output]}") if options[:output] && options[:output] !~ Doing::Plugins.plugin_regex(type: :export)
2395
2473
 
@@ -2411,7 +2489,7 @@ command :since do |c|
2411
2489
  options[:sort_tags] = options[:tag_sort] =~ /^n/i
2412
2490
 
2413
2491
  Doing::Pager.page wwid.list_date([start, finish], options[:section], options[:times], options[:output],
2414
- { duration: options[:duration], totals: options[:totals], sort_tags: options[:sort_tags] }).chomp
2492
+ { template: options[:template], config_template: options[:config_template], duration: options[:duration], totals: options[:totals], sort_tags: options[:sort_tags] }).chomp
2415
2493
  end
2416
2494
  end
2417
2495
 
@@ -2671,6 +2749,14 @@ command :yesterday do |c|
2671
2749
  c.arg_name 'FORMAT'
2672
2750
  c.flag %i[o output]
2673
2751
 
2752
+ c.desc "Output using a template from configuration"
2753
+ c.arg_name 'TEMPLATE_KEY'
2754
+ c.flag [:config_template], type: TemplateName, default_value: 'today'
2755
+
2756
+ c.desc 'Override output format with a template string containing %placeholders'
2757
+ c.arg_name 'TEMPLATE_STRING'
2758
+ c.flag [:template]
2759
+
2674
2760
  c.desc 'Show time intervals on @done tasks'
2675
2761
  c.switch %i[t times], default_value: true, negatable: true
2676
2762
 
@@ -2712,16 +2798,10 @@ command :yesterday do |c|
2712
2798
  end.join(' to ').split_date_range
2713
2799
  end
2714
2800
 
2715
- opt = {
2716
- after: options[:after],
2717
- before: options[:before],
2718
- duration: options[:duration],
2719
- from: options[:from],
2720
- sort_tags: options[:sort_tags],
2721
- tag_order: options[:tag_order].normalize_order,
2722
- totals: options[:totals],
2723
- order: settings.dig('templates', 'today', 'order')
2724
- }
2801
+ opt = options.dup
2802
+ opt[:tag_order] = options[:tag_order].normalize_order
2803
+ opt[:order] = settings.dig('templates', options[:config_template], 'order')
2804
+
2725
2805
  Doing::Pager.page wwid.yesterday(options[:section], options[:times], options[:output], opt).chomp
2726
2806
  end
2727
2807
  end
@@ -3582,17 +3662,44 @@ end
3582
3662
 
3583
3663
  # @@changelog @@changes
3584
3664
  desc 'List recent changes in Doing'
3585
- long_desc 'Display a formatted list of changes in recent versions, latest at the top'
3586
- command %i[changelog changes] do |c|
3665
+ long_desc %(Display a formatted list of changes in recent versions.
3666
+
3667
+ Without flags, displays only the most recent version.
3668
+ Use --lookup or --all for history.)
3669
+ command %i[changes changelog] do |c|
3670
+ c.desc 'Display all versions'
3671
+ c.switch %i[a all], default_value: false, negatable: false
3672
+
3673
+ c.desc %(Look up a specific version. Specify versions as "MAJ.MIN.PATCH", MIN
3674
+ and PATCH are optional. Use > or < to see all changes since or prior
3675
+ to a version.)
3676
+ c.arg_name 'VERSION'
3677
+ c.flag %i[l lookup], must_match: /^(?:(?:(?:[<>=]|p(?:rior)|b(?:efore)|o(?:lder)|s(?:ince)|a(?:fter)|n(?:ewer))? *[\d.*?]+ *)+|(?:[\d.]+ *-+ *[\d.]+))$/
3678
+
3679
+ c.desc %(Show changelogs matching search terms (uses pattern-based searching).
3680
+ Add slashes to search with regular expressions, e.g. `--search "/output.*flag/"`)
3681
+ c.flag %i[s search]
3682
+
3683
+ c.example 'doing changes', desc: 'View changes in the current version'
3684
+ c.example 'doing changes --all', desc: 'See the entire changelog'
3685
+ c.example 'doing changes --lookup 2.0.21', desc: 'See changes from version 2.0.21'
3686
+ c.example 'doing changes --lookup "> 2.1"', desc: 'See all changes since 2.1.0'
3687
+ c.example 'doing changes --search "tags +bool"', desc: 'See all changes containing "tags" and "bool"'
3688
+ c.example 'doing changes -l "> 2.1" -s "pattern"', desc: 'Lookup and search can be combined'
3689
+
3690
+
3587
3691
  c.action do |_global_options, options, args|
3588
- changelog = File.expand_path(File.join(File.dirname(__FILE__), '..', 'CHANGELOG.md'))
3589
- if File.exist?(changelog)
3590
- parsed = TTY::Markdown.parse(IO.read(changelog), width: 80, symbols: {override: {bullet: "•"}})
3591
- Doing::Pager.paginate = true
3592
- Doing::Pager.page parsed
3593
- else
3594
- raise "Error locating changelog"
3595
- end
3692
+ cl = Doing::Changes.new(lookup: options[:lookup], search: options[:search])
3693
+
3694
+ content = if options[:all] || options[:search] || options[:lookup]
3695
+ cl.to_s
3696
+ else
3697
+ cl.latest
3698
+ end
3699
+
3700
+ parsed = TTY::Markdown.parse(content, width: 80, symbols: {override: {bullet: "•"}})
3701
+ Doing::Pager.paginate = true
3702
+ Doing::Pager.page parsed
3596
3703
  end
3597
3704
  end
3598
3705
 
data/docs/doc/Array.html CHANGED
@@ -579,15 +579,20 @@ with</p>
579
579
  <div class="discussion">
580
580
  <p>Convert strings to @tags</p>
581
581
 
582
- <p>[&#39;one&#39;, &#39;@two&#39;, &#39;three&#39;].to_tags</p>
583
-
584
- <h1 id="one-two-three">=&gt; [&#39;@one&#39;, &#39;@two&#39;, &#39;@three&#39;]</h1>
585
-
586
582
 
587
583
  </div>
588
584
  </div>
589
585
  <div class="tags">
590
586
 
587
+ <div class="examples">
588
+ <p class="tag_title">Examples:</p>
589
+
590
+
591
+ <pre class="example code"><code><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>one</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>@two</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>three</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_tags'>to_tags</span>
592
+ <span class='comment'># =&gt; [&#39;@one&#39;, &#39;@two&#39;, &#39;@three&#39;]</span></code></pre>
593
+
594
+ </div>
595
+
591
596
  <p class="tag_title">Returns:</p>
592
597
  <ul class="return">
593
598
 
@@ -626,7 +631,7 @@ with</p>
626
631
  </div>
627
632
 
628
633
  <div id="footer">
629
- Generated on Fri Jan 21 14:53:33 2022 by
634
+ Generated on Sat Jan 22 16:00:27 2022 by
630
635
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
631
636
  0.9.27 (ruby-3.0.1).
632
637
  </div>
@@ -283,7 +283,7 @@
283
283
  </div>
284
284
 
285
285
  <div id="footer">
286
- Generated on Fri Jan 21 14:53:34 2022 by
286
+ Generated on Sat Jan 22 16:00:28 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 Fri Jan 21 14:53:34 2022 by
165
+ Generated on Sat Jan 22 16:00:28 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 Fri Jan 21 14:53:34 2022 by
410
+ Generated on Sat Jan 22 16:00:28 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 Fri Jan 21 14:53:34 2022 by
128
+ Generated on Sat Jan 22 16:00:28 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 Fri Jan 21 14:53:34 2022 by
117
+ Generated on Sat Jan 22 16:00:28 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 Fri Jan 21 14:53:33 2022 by
108
+ Generated on Sat Jan 22 16:00:27 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>
@@ -512,7 +512,7 @@ ANSI-sequences are stripped from the string.</p>
512
512
  </div>
513
513
 
514
514
  <div id="footer">
515
- Generated on Fri Jan 21 14:53:33 2022 by
515
+ Generated on Sat Jan 22 16:00:27 2022 by
516
516
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
517
517
  0.9.27 (ruby-3.0.1).
518
518
  </div>
@@ -206,7 +206,7 @@ stdout</p>
206
206
  </div>
207
207
 
208
208
  <div id="footer">
209
- Generated on Fri Jan 21 14:53:33 2022 by
209
+ Generated on Sat Jan 22 16:00:27 2022 by
210
210
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
211
211
  0.9.27 (ruby-3.0.1).
212
212
  </div>
@@ -534,7 +534,7 @@
534
534
  <li class="public ">
535
535
  <span class="summary_signature">
536
536
 
537
- <a href="#resolve_key_path-instance_method" title="#resolve_key_path (instance method)">#<strong>resolve_key_path</strong>(keypath, create: false) &#x21d2; Array </a>
537
+ <a href="#resolve_key_path-instance_method" title="#resolve_key_path (instance method)">#<strong>resolve_key_path</strong>(keypath, create: false, distance: 2) &#x21d2; Array </a>
538
538
 
539
539
 
540
540
 
@@ -956,7 +956,7 @@ defaults.</p>
956
956
  <div class="method_details ">
957
957
  <h3 class="signature " id="resolve_key_path-instance_method">
958
958
 
959
- #<strong>resolve_key_path</strong>(keypath, create: false) &#x21d2; <tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span></tt>
959
+ #<strong>resolve_key_path</strong>(keypath, create: false, distance: 2) &#x21d2; <tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span></tt>
960
960
 
961
961
 
962
962
 
@@ -1106,7 +1106,7 @@ matched, first match wins)</p>
1106
1106
  </div>
1107
1107
 
1108
1108
  <div id="footer">
1109
- Generated on Fri Jan 21 14:53:34 2022 by
1109
+ Generated on Sat Jan 22 16:00:28 2022 by
1110
1110
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1111
1111
  0.9.27 (ruby-3.0.1).
1112
1112
  </div>
@@ -176,7 +176,7 @@
176
176
  </div>
177
177
 
178
178
  <div id="footer">
179
- Generated on Fri Jan 21 14:53:33 2022 by
179
+ Generated on Sat Jan 22 16:00:27 2022 by
180
180
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
181
181
  0.9.27 (ruby-3.0.1).
182
182
  </div>
@@ -176,7 +176,7 @@
176
176
  </div>
177
177
 
178
178
  <div id="footer">
179
- Generated on Fri Jan 21 14:53:33 2022 by
179
+ Generated on Sat Jan 22 16:00:27 2022 by
180
180
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
181
181
  0.9.27 (ruby-3.0.1).
182
182
  </div>
@@ -176,7 +176,7 @@
176
176
  </div>
177
177
 
178
178
  <div id="footer">
179
- Generated on Fri Jan 21 14:53:33 2022 by
179
+ Generated on Sat Jan 22 16:00:27 2022 by
180
180
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
181
181
  0.9.27 (ruby-3.0.1).
182
182
  </div>
@@ -176,7 +176,7 @@
176
176
  </div>
177
177
 
178
178
  <div id="footer">
179
- Generated on Fri Jan 21 14:53:33 2022 by
179
+ Generated on Sat Jan 22 16:00:27 2022 by
180
180
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
181
181
  0.9.27 (ruby-3.0.1).
182
182
  </div>
@@ -176,7 +176,7 @@
176
176
  </div>
177
177
 
178
178
  <div id="footer">
179
- Generated on Fri Jan 21 14:53:33 2022 by
179
+ Generated on Sat Jan 22 16:00:27 2022 by
180
180
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
181
181
  0.9.27 (ruby-3.0.1).
182
182
  </div>