doing 2.1.26 → 2.1.27

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 (151) hide show
  1. checksums.yaml +4 -4
  2. data/.yardoc/checksums +14 -19
  3. data/.yardoc/object_types +0 -0
  4. data/.yardoc/objects/root.dat +0 -0
  5. data/CHANGELOG.md +23 -0
  6. data/Dockerfile +5 -5
  7. data/Dockerfile-2.6 +5 -5
  8. data/Dockerfile-2.7 +5 -4
  9. data/Dockerfile-3.0 +5 -4
  10. data/Gemfile.lock +1 -1
  11. data/README.md +1 -1
  12. data/Rakefile +2 -3
  13. data/bin/commands/add_section.rb +2 -0
  14. data/bin/commands/again.rb +23 -65
  15. data/bin/commands/archive.rb +20 -61
  16. data/bin/commands/cancel.rb +27 -69
  17. data/bin/commands/changes.rb +32 -5
  18. data/bin/commands/colors.rb +4 -2
  19. data/bin/commands/commands.rb +4 -2
  20. data/bin/commands/commands_accepting.rb +62 -11
  21. data/bin/commands/completion.rb +10 -7
  22. data/bin/commands/config.rb +1 -1
  23. data/bin/commands/done.rb +3 -17
  24. data/bin/commands/finish.rb +7 -30
  25. data/bin/commands/flag.rb +15 -51
  26. data/bin/commands/grep.rb +12 -28
  27. data/bin/commands/import.rb +3 -33
  28. data/bin/commands/last.rb +3 -36
  29. data/bin/commands/meanwhile.rb +3 -13
  30. data/bin/commands/note.rb +13 -52
  31. data/bin/commands/now.rb +15 -21
  32. data/bin/commands/on.rb +3 -4
  33. data/bin/commands/recent.rb +3 -4
  34. data/bin/commands/redo.rb +6 -2
  35. data/bin/commands/reset.rb +19 -52
  36. data/bin/commands/rotate.rb +5 -36
  37. data/bin/commands/select.rb +23 -41
  38. data/bin/commands/show.rb +28 -74
  39. data/bin/commands/since.rb +3 -4
  40. data/bin/commands/tag.rb +4 -34
  41. data/bin/commands/tags.rb +5 -32
  42. data/bin/commands/today.rb +3 -4
  43. data/bin/commands/view.rb +36 -73
  44. data/bin/commands/yesterday.rb +4 -5
  45. data/bin/doing +150 -13
  46. data/docs/doc/Array.html +3 -502
  47. data/docs/doc/BooleanTermParser/Clause.html +1 -1
  48. data/docs/doc/BooleanTermParser/Operator.html +1 -1
  49. data/docs/doc/BooleanTermParser/Query.html +1 -1
  50. data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
  51. data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
  52. data/docs/doc/BooleanTermParser.html +1 -1
  53. data/docs/doc/Doing/Color.html +62 -56
  54. data/docs/doc/Doing/Completion.html +1 -1
  55. data/docs/doc/Doing/Configuration.html +35 -1
  56. data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
  57. data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
  58. data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
  59. data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
  60. data/docs/doc/Doing/Errors/NoResults.html +1 -1
  61. data/docs/doc/Doing/Errors/PluginException.html +1 -1
  62. data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
  63. data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
  64. data/docs/doc/Doing/Errors.html +1 -1
  65. data/docs/doc/Doing/Hooks.html +1 -1
  66. data/docs/doc/Doing/Item.html +1 -1
  67. data/docs/doc/Doing/Items.html +2 -2
  68. data/docs/doc/Doing/LogAdapter.html +1 -1
  69. data/docs/doc/Doing/Note.html +2 -2
  70. data/docs/doc/Doing/Pager.html +1 -1
  71. data/docs/doc/Doing/Plugins.html +1 -1
  72. data/docs/doc/Doing/Prompt.html +1 -1
  73. data/docs/doc/Doing/Section.html +1 -1
  74. data/docs/doc/Doing/TemplateString.html +2 -2
  75. data/docs/doc/Doing/Types.html +41 -1
  76. data/docs/doc/Doing/Util/Backup.html +1 -1
  77. data/docs/doc/Doing/Util.html +1 -1
  78. data/docs/doc/Doing/WWID.html +10 -10
  79. data/docs/doc/Doing.html +3 -3
  80. data/docs/doc/FalseClass.html +35 -1
  81. data/docs/doc/GLI/Commands/Help.html +1 -1
  82. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  83. data/docs/doc/GLI/Commands.html +1 -1
  84. data/docs/doc/GLI.html +1 -1
  85. data/docs/doc/Hash.html +1 -1
  86. data/docs/doc/Object.html +1 -1
  87. data/docs/doc/PhraseParser/Operator.html +1 -1
  88. data/docs/doc/PhraseParser/PhraseClause.html +1 -1
  89. data/docs/doc/PhraseParser/Query.html +1 -1
  90. data/docs/doc/PhraseParser/QueryParser.html +1 -1
  91. data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
  92. data/docs/doc/PhraseParser/TermClause.html +1 -1
  93. data/docs/doc/PhraseParser.html +1 -1
  94. data/docs/doc/Status.html +1 -1
  95. data/docs/doc/String.html +287 -3155
  96. data/docs/doc/Symbol.html +40 -6
  97. data/docs/doc/Time.html +1 -1
  98. data/docs/doc/TrueClass.html +35 -1
  99. data/docs/doc/_index.html +5 -10
  100. data/docs/doc/class_list.html +1 -1
  101. data/docs/doc/file.README.html +2 -2
  102. data/docs/doc/index.html +2 -2
  103. data/docs/doc/method_list.html +278 -678
  104. data/docs/doc/top-level-namespace.html +2 -2
  105. data/doing.rdoc +277 -175
  106. data/lib/completion/_doing.zsh +33 -29
  107. data/lib/completion/doing.bash +30 -19
  108. data/lib/completion/doing.fish +84 -72
  109. data/lib/doing/array/array.rb +4 -0
  110. data/lib/doing/array/nested_hash.rb +17 -0
  111. data/lib/doing/{array.rb → array/tags.rb} +7 -25
  112. data/lib/doing/changelog/change.rb +26 -11
  113. data/lib/doing/changelog/changes.rb +13 -3
  114. data/lib/doing/{array_chronify.rb → chronify/array.rb} +0 -0
  115. data/lib/doing/chronify/chronify.rb +5 -0
  116. data/lib/doing/{numeric_chronify.rb → chronify/numeric.rb} +0 -0
  117. data/lib/doing/{string_chronify.rb → chronify/string.rb} +0 -0
  118. data/lib/doing/colors.rb +115 -54
  119. data/lib/doing/configuration.rb +4 -0
  120. data/lib/doing/good.rb +8 -0
  121. data/lib/doing/help_monkey_patch.rb +6 -5
  122. data/lib/doing/item.rb +5 -5
  123. data/lib/doing/items.rb +2 -2
  124. data/lib/doing/log_adapter.rb +35 -2
  125. data/lib/doing/normalize.rb +188 -0
  126. data/lib/doing/plugins/export/dayone_export.rb +1 -1
  127. data/lib/doing/plugins/export/html_export.rb +1 -1
  128. data/lib/doing/plugins/export/json_export.rb +1 -1
  129. data/lib/doing/plugins/export/markdown_export.rb +1 -1
  130. data/lib/doing/plugins/export/template_export.rb +3 -1
  131. data/lib/doing/prompt.rb +1 -3
  132. data/lib/doing/string/highlight.rb +95 -0
  133. data/lib/doing/string/query.rb +129 -0
  134. data/lib/doing/string/string.rb +12 -0
  135. data/lib/doing/string/tags.rb +164 -0
  136. data/lib/doing/string/transform.rb +168 -0
  137. data/lib/doing/string/truncate.rb +75 -0
  138. data/lib/doing/string/url.rb +82 -0
  139. data/lib/doing/template_string.rb +0 -22
  140. data/lib/doing/types.rb +8 -0
  141. data/lib/doing/util.rb +13 -9
  142. data/lib/doing/version.rb +1 -1
  143. data/lib/doing/wwid.rb +53 -35
  144. data/lib/doing.rb +4 -6
  145. data/lib/examples/plugins/wiki_export/wiki_export.rb +1 -1
  146. data/lib/helpers/threaded_tests.rb +15 -2
  147. data/scripts/deploy.rb +107 -0
  148. data/scripts/runtests.sh +4 -0
  149. metadata +19 -8
  150. data/lib/doing/string.rb +0 -765
  151. data/lib/doing/symbol.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89acdccf306ca4dc321dc892e5fea91070b002a16f37672791d8d62db2adc640
4
- data.tar.gz: 3380e462bf2744a887192282ea1adfadefec985140aa0a701fd3f60bddc9f8db
3
+ metadata.gz: eb5059bc679e2f0eff1249b466945518f4f758ea2aed81730a0da04d8e28631e
4
+ data.tar.gz: d87403fa3ac7ecb8d728f8499da593316755ecee226037e8ae6f9df9d6aa7217
5
5
  SHA512:
6
- metadata.gz: 0ba19a752642d7c974ce5c2c209571f81001453b30c8c4062cac25cb985919bcb0c0e42fbd3cf157e5a40db809f521e96dbdde949725347b33f5b237080ef8d2
7
- data.tar.gz: b446437bc24b5476a052d6370d793828a63f88bf0b04af21e869ccc16c146cbdb88a53220f732471c7a1646e77ca8763c295ee255fe6e2aaaf064213700cacdb
6
+ metadata.gz: dd67a8a4428e4391107854a934f05b5d9521d50aa34f5be8e7f7483d23de603cb7faa2b0e6b8ad7fce2cd063c6ee06c2af00a58e954b485b6c51d11e34f0534c
7
+ data.tar.gz: 03dad3b0c6aa74dfb25c4b3abbff5c7feba0e4a81a897cb9166e5352494abd22359dabd59c66d654b41dd97151c4e100bca01d599c141c4820e28f4fc3c6ab50
data/.yardoc/checksums CHANGED
@@ -1,34 +1,29 @@
1
- lib/doing/good.rb de4a18a87ac6d316037750944f91f0a3739adafc
1
+ lib/doing/good.rb afeaffc5f1931b2892aa611125da461178ca1def
2
2
  lib/doing/hash.rb 321c27f54f332260c6adced7e451016b79574d38
3
- lib/doing/item.rb 8aec1775784e73fd7181efca4482dac94d466619
3
+ lib/doing/item.rb b5c5cc0d1543b678ee2c4bc10d381e555e318b82
4
4
  lib/doing/note.rb bbadd9e34e6dc43a2af1110a5107f46c39d2547f
5
5
  lib/doing/time.rb 60183c3c31532ffea1440c766de0f90042e0fd10
6
- lib/doing/util.rb 183577d0d9dee966dcf65645b312b17b958e46d6
7
- lib/doing/wwid.rb 1410410c6072cc330baedea27e30a371ec7d3136
8
- lib/doing/array.rb b50c4604cb685dff87bc16bc20f21a5956b2b396
6
+ lib/doing/util.rb 3c5a795dce204584be149e9bbcf1d25f3368e901
7
+ lib/doing/wwid.rb f7ea82f7f5becf9b83ab36d3932250f7bd5ac758
9
8
  lib/doing/hooks.rb 1b75ca731f9e8cb0b7a32785d6e496ee67a70d5c
10
- lib/doing/items.rb 69c762d337d9dad2b780cd08cc1c8785310e23ba
9
+ lib/doing/items.rb dbda21422a06828f221fe462ff159d228b942044
11
10
  lib/doing/pager.rb 7f9d5551c8f5411c3d39b3d984ac7118f98f5da5
12
- lib/doing/types.rb df05c1282d5f6b8efda68c6f289499683a5cc7d1
13
- lib/doing/colors.rb b7239a69e10c5df9378a5843441af5b93c1872f8
11
+ lib/doing/types.rb 6263b1871efa1e8f6053d3bce69ebf678d27324e
12
+ lib/doing/colors.rb 8c2d1c8c7e99022d33f1548c5456a0f02d570c4f
14
13
  lib/doing/errors.rb af07e482a5389924edc2337749c81cda501098f0
15
- lib/doing/prompt.rb eaa388322b1c8190e50882638e70b58010376c8d
16
- lib/doing/string.rb 32fd00cfdfb01a664e194e70ffcad199cd217741
17
- lib/doing/symbol.rb 309799458a1bc715c2707307c9a62ab26086275e
14
+ lib/doing/prompt.rb 330b8e6e1e85f73b54f602a0aeac58b6b422fabb
18
15
  lib/doing/section.rb 206e119cf818f1e76798753e611180fe77bc299a
19
- lib/doing/version.rb a44860dcd8bbb820478d02ef0f8e2378db4a9b15
16
+ lib/doing/version.rb 03aed95553bbebdccc69d107db1bec724edaa417
20
17
  lib/doing/changelog.rb f7d1bd424e63400ab0613ef3358e614fdf53e2b5
18
+ lib/doing/normalize.rb b9925102db5f19cae0e524ffd1be979ab5bc1199
21
19
  lib/doing/cli_status.rb dbedd454c4cbbd0fed9ef30120f6ec85d18b9356
22
20
  lib/doing/completion.rb c658e7dc7898fb022a21b2bd77bedb958ca3b067
23
- lib/doing/log_adapter.rb 62ee66981878bd7285ccf0dfeca90a3d6d2af985
21
+ lib/doing/log_adapter.rb 1bc8cab3af769a0caa0c64e8ce63c7860a628578
24
22
  lib/doing/util_backup.rb c13f71072581b1f0d2269853611ba09273261bf9
25
- lib/doing/configuration.rb 30c3d9ada7d8e538fcdf725318845ad5310facf6
23
+ lib/doing/configuration.rb e47013cdc92ee5312cf0feddfb52ffac033c7f41
26
24
  lib/doing/phrase_parser.rb 8f1789d7cf8326d8cc231b4a21505a93f8de20d2
27
- lib/doing/array_chronify.rb b39b40268b1751b18acf6bae4e53885818e45f62
28
25
  lib/doing/plugin_manager.rb cb16a82c3182ef7008359670ab96ff6b39270ccc
29
- lib/doing/string_chronify.rb 888afa2175f3bb6cac0d68e3cb0f27cf162bb1bf
30
- lib/doing/template_string.rb 3b35970f2a68112192d2bb97c1298b90cf717b3d
31
- lib/doing/numeric_chronify.rb bedeff62a95f8a8ff116e1bf0cc1d9eb2707a900
32
- lib/doing/help_monkey_patch.rb 6aa514c249e519db507ae528de2604c18cc36045
26
+ lib/doing/template_string.rb 5d7c7ac9bdf0d44bc32a0442b2fdd243bd1eee24
27
+ lib/doing/help_monkey_patch.rb bd234939e797f2578c1155985383ef4a279d4d46
33
28
  lib/doing/boolean_term_parser.rb 075977892ac5c6e3435cb8877d8b8b68eb1962e3
34
29
  lib/doing/markdown_document_listener.rb 45485f225068a34951ec818a345f642323e5ba35
data/.yardoc/object_types CHANGED
Binary file
Binary file
data/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ ### 2.1.27
2
+
3
+ 2022-02-14 06:04
4
+
5
+ #### NEW
6
+
7
+ - `doing finish --update` will overwrite any existing @done tag with a new date (current time or set with `--at` or `--back`)
8
+
9
+ #### IMPROVED
10
+
11
+ - Code refactoring and cleanup
12
+ - Include release dates in `doing changes` output when available
13
+ - Allow various naming conventions for %color strings in templates. Now `boldwhite`, `brightwhite`, `bg_bold_cyan`, and `bold_bg_cyan` all work (for example)
14
+ - Common flags (e.g. --search, --tag) found on multiple commands consolidated and help descriptions matched
15
+ - `commands_accepting` now accepts multiple arguments and a `--bool` flag
16
+ - `changes` command can now output changes only (no version numbers) and defaults to raw Markdown if not a TTY or the `--md` flag is used
17
+ - `doing archive` now accepts `--after` and `--from` date filters
18
+
19
+ #### FIXED
20
+
21
+ - Some flag descriptions in help
22
+ - Editor detection
23
+
1
24
  ### 2.1.26
2
25
 
3
26
  2022-01-23 16:14
data/Dockerfile CHANGED
@@ -1,9 +1,9 @@
1
1
  FROM ruby:3.0.1
2
- RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
2
+ # RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
3
3
  RUN mkdir /doing
4
4
  WORKDIR /doing
5
- COPY ./ /doing/
5
+ # COPY ./ /doing/
6
6
  RUN gem install bundler:2.2.17
7
- # RUN bundle update --bundler
8
- RUN bundle install
9
- CMD ["rake", "parallel:test"]
7
+ RUN apt-get update -y
8
+ RUN apt-get install -y less
9
+ CMD ["scripts/runtests.sh"]
data/Dockerfile-2.6 CHANGED
@@ -1,9 +1,9 @@
1
1
  FROM ruby:2.6
2
+ # RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
2
3
  RUN mkdir /doing
3
4
  WORKDIR /doing
4
- COPY ./ /doing/
5
+ # COPY ./ /doing/
5
6
  RUN gem install bundler:2.2.17
6
- # RUN bundle update --bundler
7
- RUN bundle install
8
- # ENTRYPOINT rake parallel:test
9
- CMD ["rake", "parallel:test"]
7
+ RUN apt-get update -y
8
+ RUN apt-get install -y less
9
+ CMD ["scripts/runtests.sh"]
data/Dockerfile-2.7 CHANGED
@@ -1,8 +1,9 @@
1
1
  FROM ruby:2.7
2
+ RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
2
3
  RUN mkdir /doing
3
4
  WORKDIR /doing
4
- COPY ./ /doing/
5
+ # COPY ./ /doing/
5
6
  RUN gem install bundler:2.2.17
6
- # RUN bundle update --bundler
7
- RUN bundle install
8
- CMD ["rake", "parallel:test"]
7
+ RUN apt-get update -y
8
+ RUN apt-get install -y less
9
+ CMD ["scripts/runtests.sh"]
data/Dockerfile-3.0 CHANGED
@@ -1,8 +1,9 @@
1
1
  FROM ruby:3.0.0
2
+ # RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
2
3
  RUN mkdir /doing
3
4
  WORKDIR /doing
4
- COPY ./ /doing/
5
+ # COPY ./ /doing/
5
6
  RUN gem install bundler:2.2.17
6
- # RUN bundle update --bundler
7
- RUN bundle install
8
- CMD ["rake", "parallel:test"]
7
+ RUN apt-get update -y
8
+ RUN apt-get install -y less
9
+ CMD ["scripts/runtests.sh"]
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- doing (2.1.26)
4
+ doing (2.1.27)
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.25<!--END VER-->.
11
+ The current version of `doing` is <!--VER-->2.1.26<!--END VER-->.
12
12
 
13
13
  Find all of the documentation in the [doing wiki][wiki].
14
14
 
data/Rakefile CHANGED
@@ -77,15 +77,14 @@ task :dockertest, :version, :login do |_, args|
77
77
  file = 'Dockerfile'
78
78
  end
79
79
 
80
-
81
80
  puts `docker build . --file #{file} -t #{img}`
82
81
 
83
- exec "docker run -it #{img} /bin/bash -l" if args[:login]
82
+ exec "docker run -v #{File.dirname(__FILE__)}:/doing -it #{img} /bin/bash -l" if args[:login]
84
83
 
85
84
  spinner = TTY::Spinner.new('[:spinner] Running tests ...', hide_cursor: true)
86
85
 
87
86
  spinner.auto_spin
88
- res = `docker run --rm -it #{img}`
87
+ res = `docker run --rm -v #{File.dirname(__FILE__)}:/doing -it #{img}`
89
88
  # commit = puts `bash -c "docker commit $(docker ps -a|grep #{img}|awk '{print $1}'|head -n 1) #{img}"`.strip
90
89
  spinner.success
91
90
  spinner.stop
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@add_section
2
4
  desc 'Add a new section to the "doing" file'
3
5
  arg_name 'SECTION_NAME'
@@ -1,11 +1,18 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@again @@resume
2
4
  desc 'Repeat last entry as new entry'
3
- long_desc 'This command is designed to allow multiple time intervals to be created for an entry by duplicating it with a new start (and end, eventually) time'
5
+ long_desc 'This command is designed to allow multiple time intervals to be created
6
+ for an entry by duplicating it with a new start (and end, eventually) time'
4
7
  command %i[again resume] do |c|
5
- c.example 'doing resume', desc: 'Duplicate the most recent entry with a new start time, removing any @done tag'
6
- c.example 'doing again', desc: 'again is an alias for resume'
7
- c.example 'doing resume --editor', desc: 'Repeat the last entry, opening the new entry in the default editor'
8
- c.example 'doing resume --tag project1 --in Projects', desc: 'Repeat the last entry tagged @project1, creating the new entry in the Projects section'
8
+ c.example 'doing resume',
9
+ desc: 'Duplicate the most recent entry with a new start time, removing any @done tag'
10
+ c.example 'doing again',
11
+ desc: 'again is an alias for resume'
12
+ c.example 'doing resume --editor',
13
+ desc: 'Repeat the last entry, opening the new entry in the default editor'
14
+ c.example 'doing resume --tag project1 --in Projects',
15
+ desc: 'Repeat the last entry tagged @project1, creating the new entry in the Projects section'
9
16
  c.example 'doing resume --interactive', desc: 'Select the entry to repeat from a menu'
10
17
 
11
18
  c.desc 'Get last entry from a specific section'
@@ -16,84 +23,35 @@ command %i[again resume] do |c|
16
23
  c.arg_name 'SECTION_NAME'
17
24
  c.flag [:in]
18
25
 
19
- c.desc 'Backdate start date by interval or set to time [4pm|20m|2h|"yesterday noon"]'
20
- c.arg_name 'DATE_STRING'
21
- c.flag %i[b back started], type: DateBeginString
22
-
23
- c.desc 'Repeat last entry matching tags. Combine multiple tags with a comma. Wildcards allowed (*, ?)'
24
- c.arg_name 'TAG'
25
- c.flag [:tag], type: TagArray
26
-
27
- c.desc 'Repeat last entry matching search. Surround with
28
- slashes for regex (e.g. "/query/"), start with a single quote for exact match ("\'query").'
29
- c.arg_name 'QUERY'
30
- c.flag [:search]
31
-
32
- c.desc 'Perform a tag value query ("@done > two hours ago" or "@progress < 50"). May be used multiple times, combined with --bool'
33
- c.arg_name 'QUERY'
34
- c.flag [:val], multiple: true, must_match: REGEX_VALUE_QUERY
35
-
36
- # c.desc '[DEPRECATED] Use alternative fuzzy matching for search string'
37
- # c.switch [:fuzzy], default_value: false, negatable: false
38
-
39
- c.desc 'Force exact search string matching (case sensitive)'
40
- c.switch %i[x exact], default_value: @config.exact_match?, negatable: @config.exact_match?
41
-
42
- c.desc 'Resume items that *don\'t* match search/tag filters'
43
- c.switch [:not], default_value: false, negatable: false
44
-
45
- c.desc 'Case sensitivity for search string matching [(c)ase-sensitive, (i)gnore, (s)mart]'
46
- c.arg_name 'TYPE'
47
- c.flag [:case], must_match: /^[csi]/, default_value: @settings.dig('search', 'case')
48
-
49
- c.desc 'Boolean used to combine multiple tags. Use PATTERN to parse + and - as booleans'
50
- c.arg_name 'BOOLEAN'
51
- c.flag [:bool], must_match: REGEX_BOOL, default_value: 'PATTERN'
52
-
53
- c.desc "Edit duplicated entry with #{Doing::Util.default_editor} before adding"
54
- c.switch %i[e editor], negatable: false, default_value: false
55
-
56
- c.desc 'Add a note'
57
- c.arg_name 'TEXT'
58
- c.flag %i[n note]
59
-
60
- c.desc 'Prompt for note via multi-line input'
61
- c.switch %i[ask], negatable: false, default_value: false
62
-
63
26
  c.desc 'Select item to resume from a menu of matching entries'
64
27
  c.switch %i[i interactive], negatable: false, default_value: false
65
28
 
29
+ add_options(:add_entry, c)
30
+ add_options(:search, c)
31
+ add_options(:tag_filter, c)
32
+
66
33
  c.action do |_global_options, options, _args|
67
34
  options[:fuzzy] = false
68
- tags = options[:tag].nil? ? [] : options[:tag]
69
-
70
- options[:case] = options[:case].normalize_case
71
35
 
72
36
  if options[:search]
73
- search = options[:search]
74
- search.sub!(/^'?/, "'") if options[:exact]
75
- options[:search] = search
37
+ options[:search] = options[:exact] ? options[:search].sub(/^'?/, "'") : options[:search]
76
38
  end
77
39
 
78
40
  if options[:back]
79
- date = options[:back]
41
+ options[:date] = options[:back]
80
42
  raise InvalidTimeExpression, 'Unable to parse date string for --back' if date.nil?
43
+
81
44
  else
82
- date = Time.now
45
+ options[:date] = Time.now
83
46
  end
84
47
 
85
48
  note = Doing::Note.new(options[:note])
86
49
  note.add(Doing::Prompt.read_lines(prompt: 'Add a note')) if options[:ask]
87
50
 
88
51
  options[:note] = note
52
+ options[:tag] ||= []
53
+ options[:tag_bool] = options[:bool]
89
54
 
90
- opts = options.clone
91
-
92
- opts[:tag] = tags
93
- opts[:tag_bool] = options[:bool].normalize_bool
94
- opts[:interactive] = options[:interactive]
95
- opts[:date] = date
96
-
97
- @wwid.repeat_last(opts)
55
+ @wwid.repeat_last(options)
98
56
  end
99
57
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@archive @@move
2
4
  desc 'Move entries between sections'
3
5
  long_desc %(Argument can be a section name to move all entries from a section,
@@ -10,7 +12,8 @@ command %i[archive move] do |c|
10
12
  c.example 'doing archive Currently', desc: 'Move all entries in the Currently section to Archive section'
11
13
  c.example 'doing archive @done', desc: 'Move all entries tagged @done to Archive'
12
14
  c.example 'doing archive --to Later @project1', desc: 'Move all entries tagged @project1 to Later section'
13
- c.example 'doing move Later --tag project1 --to Currently', desc: 'Move entries in Later tagged @project1 to Currently (move is an alias for archive)'
15
+ c.example 'doing move Later --tag project1 --to Currently',
16
+ desc: 'Move entries in Later tagged @project1 to Currently (move is an alias for archive)'
14
17
 
15
18
  c.desc 'How many items to keep (ignored if archiving by tag or search)'
16
19
  c.arg_name 'X'
@@ -23,74 +26,30 @@ command %i[archive move] do |c|
23
26
  c.desc 'Label moved items with @from(SECTION_NAME)'
24
27
  c.switch [:label], default_value: true, negatable: true
25
28
 
26
- c.desc 'Tag filter, combine multiple tags with a comma. Wildcards allowed (*, ?). Added for compatibility with other commands'
27
- c.arg_name 'TAG'
28
- c.flag [:tag], type: TagArray
29
-
30
- c.desc 'Tag boolean (AND|OR|NOT). Use PATTERN to parse + and - as booleans'
31
- c.arg_name 'BOOLEAN'
32
- c.flag [:bool], must_match: REGEX_BOOL, default_value: 'PATTERN'
33
-
34
- c.desc 'Search filter'
35
- c.arg_name 'QUERY'
36
- c.flag [:search]
37
-
38
- c.desc 'Perform a tag value query ("@done > two hours ago" or "@progress < 50"). May be used multiple times, combined with --bool'
39
- c.arg_name 'QUERY'
40
- c.flag [:val], multiple: true, must_match: REGEX_VALUE_QUERY
41
-
42
- # c.desc '[DEPRECATED] Use alternative fuzzy matching for search string'
43
- # c.switch [:fuzzy], default_value: false, negatable: false
44
-
45
- c.desc 'Force exact search string matching (case sensitive)'
46
- c.switch %i[x exact], default_value: @config.exact_match?, negatable: @config.exact_match?
47
-
48
- c.desc 'Show items that *don\'t* match search string'
49
- c.switch [:not], default_value: false, negatable: false
50
-
51
- c.desc 'Case sensitivity for search string matching [(c)ase-sensitive, (i)gnore, (s)mart]'
52
- c.arg_name 'TYPE'
53
- c.flag [:case], must_match: /^[csi]/, default_value: @settings.dig('search', 'case')
54
-
55
- c.desc 'Archive entries older than date
56
- (Flexible date format, e.g. 1/27/2021, 2020-07-19, or Monday 3pm)'
57
- c.arg_name 'DATE_STRING'
58
- c.flag [:before], type: DateEndString
29
+ add_options(:search, c)
30
+ add_options(:tag_filter, c)
31
+ add_options(:date_filter, c)
59
32
 
60
33
  c.action do |_global_options, options, args|
61
34
  options[:fuzzy] = false
62
- if args.empty?
63
- section = @settings['current_section']
64
- tags = []
65
- elsif args[0] =~ /^all/i
66
- section = 'all'
67
- elsif args[0] =~ /^@\S+/
68
- section = 'all'
69
- tags = args.map { |t| t.sub(/^@/, '').strip }
70
- else
71
- section = args[0].cap_first
72
- tags = args.length > 1 ? args[1..].map { |t| t.sub(/^@/, '').strip } : []
73
- end
35
+ section, tags = if args.empty?
36
+ [@settings['current_section'], []]
37
+ elsif args[0] =~ /^all/i
38
+ ['all', []]
39
+ elsif args[0] =~ /^@\S+/
40
+ ['all', args.tags_to_array]
41
+ else
42
+ [args.shift.cap_first, args.tags_to_array]
43
+ end
74
44
 
75
45
  raise InvalidArgument, '--keep and --count can not be used together' if options[:keep] && options[:count]
76
46
 
77
47
  tags.concat(options[:tag]) if options[:tag]
78
48
 
79
- search = nil
80
-
81
- options[:case] = options[:case].normalize_case
82
-
83
- if options[:search]
84
- search = options[:search]
85
- search.sub!(/^'?/, "'") if options[:exact]
86
- end
87
-
88
- opts = options.clone
89
- opts[:search] = search
90
- opts[:bool] = options[:bool].normalize_bool
91
- opts[:destination] = options[:to]
92
- opts[:tags] = tags
49
+ options[:search] = options[:search].sub(/^'?/, "'") if options[:search] && options[:exact]
50
+ options[:destination] = options[:to]
51
+ options[:tags] = tags
93
52
 
94
- @wwid.archive(section, opts)
53
+ @wwid.archive(section, options)
95
54
  end
96
55
  end
@@ -1,6 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # @@cancel
2
4
  desc 'End last X entries with no time tracked'
3
- long_desc 'Adds @done tag without datestamp so no elapsed time is recorded. Alias for `doing finish --no-date`'
5
+ long_desc 'Adds @done tag without datestamp so no elapsed time is recorded.
6
+ Alias for `doing finish --no-date`'
4
7
  arg_name 'COUNT'
5
8
  command :cancel do |c|
6
9
  c.example 'doing cancel', desc: 'Cancel the last entry'
@@ -13,90 +16,45 @@ command :cancel do |c|
13
16
  c.arg_name 'NAME'
14
17
  c.flag %i[s section]
15
18
 
16
- c.desc 'Cancel the last X entries containing TAG. Separate multiple tags with comma (--tag=tag1,tag2). Wildcards allowed (*, ?)'
17
- c.arg_name 'TAG'
18
- c.flag [:tag], type: TagArray
19
-
20
- c.desc 'Boolean (AND|OR|NOT) with which to combine multiple tag filters. Use PATTERN to parse + and - as booleans'
21
- c.arg_name 'BOOLEAN'
22
- c.flag [:bool], must_match: REGEX_BOOL, default_value: 'PATTERN'
23
-
24
- c.desc 'Cancel the last X entries matching search filter, surround with slashes for regex (e.g. "/query.*/"), start with single quote for exact match ("\'query")'
25
- c.arg_name 'QUERY'
26
- c.flag [:search]
27
-
28
- c.desc 'Perform a tag value query ("@done > two hours ago" or "@progress < 50"). May be used multiple times, combined with --bool'
29
- c.arg_name 'QUERY'
30
- c.flag [:val], multiple: true, must_match: REGEX_VALUE_QUERY
31
-
32
- # c.desc '[DEPRECATED] Use alternative fuzzy matching for search string'
33
- # c.switch [:fuzzy], default_value: false, negatable: false
34
-
35
- c.desc 'Force exact search string matching (case sensitive)'
36
- c.switch %i[x exact], default_value: @config.exact_match?, negatable: @config.exact_match?
37
-
38
- c.desc 'Finish items that *don\'t* match search/tag filters'
39
- c.switch [:not], default_value: false, negatable: false
40
-
41
- c.desc 'Case sensitivity for search string matching [(c)ase-sensitive, (i)gnore, (s)mart]'
42
- c.arg_name 'TYPE'
43
- c.flag [:case], must_match: /^[csi]/, default_value: @settings.dig('search', 'case')
44
-
45
19
  c.desc 'Cancel last entry (or entries) not already marked @done'
46
20
  c.switch %i[u unfinished], negatable: false, default_value: false
47
21
 
48
22
  c.desc 'Select item(s) to cancel from a menu of matching entries'
49
23
  c.switch %i[i interactive], negatable: false, default_value: false
50
24
 
25
+ add_options(:search, c)
26
+ add_options(:tag_filter, c)
27
+
51
28
  c.action do |_global_options, options, args|
52
29
  options[:fuzzy] = false
53
- if options[:section]
54
- section = @wwid.guess_section(options[:section]) || options[:section].cap_first
55
- else
56
- section = @settings['current_section']
57
- end
58
-
59
- if options[:tag].nil?
60
- tags = []
61
- else
62
- tags = options[:tag]
63
- end
30
+ options[:section] = if options[:section]
31
+ @wwid.guess_section(options[:section]) || options[:section].cap_first
32
+ else
33
+ @settings['current_section']
34
+ end
64
35
 
65
36
  raise InvalidArgument, 'Only one argument allowed' if args.length > 1
66
37
 
67
- raise InvalidArgument, 'Invalid argument (specify number of recent items to mark @done)' unless args.empty? || args[0] =~ /\d+/
38
+ unless args.empty? || args[0] =~ /\d+/
39
+ raise InvalidArgument, 'Invalid argument (specify number of recent items to mark @done)'
68
40
 
69
- if options[:interactive]
70
- count = 0
71
- else
72
- count = args[0] ? args[0].to_i : 1
73
41
  end
74
42
 
75
- search = nil
43
+ options[:count] = if options[:interactive]
44
+ 0
45
+ else
46
+ args[0] ? args[0].to_i : 1
47
+ end
76
48
 
77
- if options[:search]
78
- search = options[:search]
79
- search.sub!(/^'?/, "'") if options[:exact]
80
- end
49
+ options[:search] = options[:search].sub(/^'?/, "'") if options[:search] && options[:exact]
81
50
 
82
- opts = {
83
- archive: options[:archive],
84
- case: options[:case].normalize_case,
85
- count: count,
86
- date: false,
87
- fuzzy: options[:fuzzy],
88
- interactive: options[:interactive],
89
- not: options[:not],
90
- search: search,
91
- section: section,
92
- sequential: false,
93
- tag: tags,
94
- tag_bool: options[:bool].normalize_bool,
95
- tags: ['done'],
96
- unfinished: options[:unfinished],
97
- val: options[:val]
98
- }
51
+ options[:case] = options[:case].normalize_case
52
+ options[:date] = false
53
+ options[:sequential] = false
54
+ options[:tag] ||= []
55
+ options[:tag_bool] = options[:bool].normalize_bool
56
+ options[:tags] = ['done']
99
57
 
100
- @wwid.tag_last(opts)
58
+ @wwid.tag_last(options)
101
59
  end
102
60
  end
@@ -1,4 +1,21 @@
1
1
  # @@changelog @@changes
2
+
3
+ MARKDOWN_THEME = {
4
+ em: %i[white dark],
5
+ header: %i[cyan bold],
6
+ hr: :yellow,
7
+ link: %i[bright_cyan underline],
8
+ list: :yellow,
9
+ strong: %i[yellow bold],
10
+ table: :yellow,
11
+ quote: :yellow,
12
+ image: :bright_black,
13
+ note: :yellow,
14
+ comment: :bright_black
15
+ }.deep_freeze
16
+
17
+ CHANGE_RX = /^(?:(?:(?:[<>=]|p(?:rior)|b(?:efore)|o(?:lder)|s(?:ince)|a(?:fter)|n(?:ewer))? *[\d.*?]+ *)+|(?:[\d.]+ *-+ *[\d.]+))$/
18
+
2
19
  desc 'List recent changes in Doing'
3
20
  long_desc %(Display a formatted list of changes in recent versions.
4
21
 
@@ -12,12 +29,18 @@ command %i[changes changelog] do |c|
12
29
  and PATCH are optional. Use > or < to see all changes since or prior
13
30
  to a version.)
14
31
  c.arg_name 'VERSION'
15
- c.flag %i[l lookup], must_match: /^(?:(?:(?:[<>=]|p(?:rior)|b(?:efore)|o(?:lder)|s(?:ince)|a(?:fter)|n(?:ewer))? *[\d.*?]+ *)+|(?:[\d.]+ *-+ *[\d.]+))$/
32
+ c.flag %i[l lookup], must_match: CHANGE_RX
16
33
 
17
34
  c.desc %(Show changelogs matching search terms (uses pattern-based searching).
18
35
  Add slashes to search with regular expressions, e.g. `--search "/output.*flag/"`)
19
36
  c.flag %i[s search]
20
37
 
38
+ c.desc 'Only output changes, no version numbers, headers, or dates'
39
+ c.switch %i[C changes], default_value: false, negatable: false
40
+
41
+ c.desc 'Output raw Markdown'
42
+ c.switch %i[m md markdown], default_value: false, negatable: false
43
+
21
44
  c.example 'doing changes', desc: 'View changes in the current version'
22
45
  c.example 'doing changes --all', desc: 'See the entire changelog'
23
46
  c.example 'doing changes --lookup 2.0.21', desc: 'See changes from version 2.0.21'
@@ -25,9 +48,8 @@ command %i[changes changelog] do |c|
25
48
  c.example 'doing changes --search "tags +bool"', desc: 'See all changes containing "tags" and "bool"'
26
49
  c.example 'doing changes -l "> 2.1" -s "pattern"', desc: 'Lookup and search can be combined'
27
50
 
28
-
29
- c.action do |_global_options, options, args|
30
- cl = Doing::Changes.new(lookup: options[:lookup], search: options[:search])
51
+ c.action do |_global_options, options, _args|
52
+ cl = Doing::Changes.new(lookup: options[:lookup], search: options[:search], changes_only: options[:changes])
31
53
 
32
54
  content = if options[:all] || options[:search] || options[:lookup]
33
55
  cl.to_s
@@ -35,7 +57,12 @@ command %i[changes changelog] do |c|
35
57
  cl.latest
36
58
  end
37
59
 
38
- parsed = TTY::Markdown.parse(content, width: 80, symbols: {override: {bullet: "•"}})
60
+ parsed = if options[:markdown] || !$stdout.isatty
61
+ content
62
+ else
63
+ TTY::Markdown.parse(content, width: 80, theme: MARKDOWN_THEME, symbols: { override: { bullet: '•' } })
64
+ end
65
+
39
66
  Doing::Pager.paginate = true
40
67
  Doing::Pager.page parsed
41
68
  end
@@ -5,10 +5,12 @@ command :colors do |c|
5
5
  bgs = []
6
6
  fgs = []
7
7
  @colors::attributes.each do |color|
8
+ colname = color.to_s
9
+ colname << " (#{color.to_s.sub(/bold/, 'bright')})" if colname =~ /bold/
8
10
  if color.to_s =~ /bg/
9
- bgs.push("#{@colors.send(color, " ")}#{@colors.default} <-- #{color.to_s}")
11
+ bgs.push("#{@colors.send(color, " ")}#{@colors.default} <-- #{colname}")
10
12
  else
11
- fgs.push("#{@colors.send(color, "XXXX")}#{@colors.default} <-- #{color.to_s}")
13
+ fgs.push("#{@colors.send(color, "XXXX")}#{@colors.default} <-- #{colname}")
12
14
  end
13
15
  end
14
16
  out = []
@@ -27,9 +27,11 @@ command :commands do |c|
27
27
  Doing::Prompt.choose_from(available,
28
28
  prompt: 'Select commands to enable',
29
29
  multiple: true,
30
- sorted: true).strip.split("\n")
30
+ sorted: true)
31
31
  end
32
- to_enable.each do |cmd|
32
+ raise UserCancelled unless to_enable
33
+
34
+ to_enable.strip.split("\n").each do |cmd|
33
35
  default_command = File.join(File.dirname(__FILE__), "#{cmd}.rb")
34
36
  custom_command = File.join(File.expand_path(custom_dir), "#{cmd}.rb")
35
37
  unless File.exist?(default_command) || File.exist?(custom_command)