doing 2.1.27 → 2.1.31pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/.irbrc +1 -0
  3. data/.yardoc/checksums +11 -10
  4. data/.yardoc/object_types +0 -0
  5. data/.yardoc/objects/root.dat +0 -0
  6. data/CHANGELOG.md +4952 -0
  7. data/Gemfile.lock +2 -1
  8. data/README.md +1 -1
  9. data/bin/commands/again.rb +1 -1
  10. data/bin/commands/archive.rb +3 -3
  11. data/bin/commands/cancel.rb +1 -1
  12. data/bin/commands/changes.rb +32 -18
  13. data/bin/commands/commands.rb +8 -8
  14. data/bin/commands/completion.rb +61 -19
  15. data/bin/commands/config.rb +16 -16
  16. data/bin/commands/done.rb +1 -1
  17. data/bin/commands/flag.rb +1 -1
  18. data/bin/commands/grep.rb +5 -5
  19. data/bin/commands/last.rb +1 -1
  20. data/bin/commands/meanwhile.rb +1 -1
  21. data/bin/commands/now.rb +1 -1
  22. data/bin/commands/on.rb +1 -1
  23. data/bin/commands/open.rb +4 -4
  24. data/bin/commands/recent.rb +4 -4
  25. data/bin/commands/show.rb +8 -8
  26. data/bin/commands/since.rb +1 -1
  27. data/bin/commands/today.rb +1 -1
  28. data/bin/commands/view.rb +3 -3
  29. data/bin/commands/yesterday.rb +2 -2
  30. data/bin/doing +22 -133
  31. data/docs/doc/Array.html +1 -1
  32. data/docs/doc/BooleanTermParser/Clause.html +1 -1
  33. data/docs/doc/BooleanTermParser/Operator.html +1 -1
  34. data/docs/doc/BooleanTermParser/Query.html +1 -1
  35. data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
  36. data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
  37. data/docs/doc/BooleanTermParser.html +1 -1
  38. data/docs/doc/Doing/Color.html +1 -1
  39. data/docs/doc/Doing/Completion.html +324 -4
  40. data/docs/doc/Doing/Configuration.html +1 -1
  41. data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
  42. data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
  43. data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
  44. data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
  45. data/docs/doc/Doing/Errors/NoResults.html +1 -1
  46. data/docs/doc/Doing/Errors/PluginException.html +1 -1
  47. data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
  48. data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
  49. data/docs/doc/Doing/Errors.html +1 -1
  50. data/docs/doc/Doing/Hooks.html +1 -1
  51. data/docs/doc/Doing/Item.html +125 -1
  52. data/docs/doc/Doing/Items.html +1 -1
  53. data/docs/doc/Doing/LogAdapter.html +1 -1
  54. data/docs/doc/Doing/Note.html +109 -3
  55. data/docs/doc/Doing/Pager.html +1 -1
  56. data/docs/doc/Doing/Plugins.html +1 -1
  57. data/docs/doc/Doing/Prompt.html +1 -1
  58. data/docs/doc/Doing/Section.html +1 -1
  59. data/docs/doc/Doing/TemplateString.html +1 -1
  60. data/docs/doc/Doing/Types.html +1 -1
  61. data/docs/doc/Doing/Util/Backup.html +1 -1
  62. data/docs/doc/Doing/Util.html +1 -1
  63. data/docs/doc/Doing/WWID.html +6 -6
  64. data/docs/doc/Doing.html +2 -2
  65. data/docs/doc/FalseClass.html +1 -1
  66. data/docs/doc/GLI/Commands/Help.html +1 -1
  67. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  68. data/docs/doc/GLI/Commands.html +1 -1
  69. data/docs/doc/GLI.html +1 -1
  70. data/docs/doc/Hash.html +1 -1
  71. data/docs/doc/Object.html +1 -1
  72. data/docs/doc/PhraseParser/Operator.html +1 -1
  73. data/docs/doc/PhraseParser/PhraseClause.html +1 -1
  74. data/docs/doc/PhraseParser/Query.html +1 -1
  75. data/docs/doc/PhraseParser/QueryParser.html +1 -1
  76. data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
  77. data/docs/doc/PhraseParser/TermClause.html +1 -1
  78. data/docs/doc/PhraseParser.html +1 -1
  79. data/docs/doc/Status.html +1 -1
  80. data/docs/doc/String.html +1 -1
  81. data/docs/doc/Symbol.html +1 -1
  82. data/docs/doc/Time.html +1 -1
  83. data/docs/doc/TrueClass.html +1 -1
  84. data/docs/doc/_index.html +3 -1
  85. data/docs/doc/file.README.html +2 -2
  86. data/docs/doc/index.html +2 -2
  87. data/docs/doc/method_list.html +337 -241
  88. data/docs/doc/top-level-namespace.html +105 -1
  89. data/doing.gemspec +1 -0
  90. data/doing.rdoc +46 -41
  91. data/example_plugin.rb +7 -5
  92. data/lib/completion/_doing.zsh +4 -8
  93. data/lib/completion/doing.bash +4 -15
  94. data/lib/completion/doing.fish +6 -9
  95. data/lib/doing/add_options.rb +117 -0
  96. data/lib/doing/array/array.rb +16 -0
  97. data/lib/doing/changelog/change.rb +1 -1
  98. data/lib/doing/changelog/changes.rb +26 -7
  99. data/lib/doing/changelog/version.rb +11 -3
  100. data/lib/doing/completion/bash_completion.rb +12 -51
  101. data/lib/doing/completion/fish_completion.rb +16 -52
  102. data/lib/doing/completion/zsh_completion.rb +12 -51
  103. data/lib/doing/completion.rb +203 -17
  104. data/lib/doing/configuration.rb +5 -5
  105. data/lib/doing/item.rb +21 -3
  106. data/lib/doing/items.rb +5 -5
  107. data/lib/doing/note.rb +24 -8
  108. data/lib/doing/plugins/export/dayone_export.rb +8 -6
  109. data/lib/doing/plugins/export/html_export.rb +4 -4
  110. data/lib/doing/plugins/export/json_export.rb +19 -20
  111. data/lib/doing/plugins/export/markdown_export.rb +2 -2
  112. data/lib/doing/plugins/export/template_export.rb +4 -4
  113. data/lib/doing/plugins/import/calendar_import.rb +1 -1
  114. data/lib/doing/plugins/import/doing_import.rb +1 -1
  115. data/lib/doing/plugins/import/timing_import.rb +1 -1
  116. data/lib/doing/section.rb +1 -1
  117. data/lib/doing/string/highlight.rb +3 -4
  118. data/lib/doing/string/string.rb +8 -0
  119. data/lib/doing/util.rb +1 -1
  120. data/lib/doing/util_backup.rb +12 -12
  121. data/lib/doing/version.rb +1 -1
  122. data/lib/doing/wwid.rb +75 -76
  123. data/lib/doing.rb +58 -0
  124. data/lib/examples/commands/wiki.rb +27 -19
  125. data/scripts/setting_replace.rb +11 -0
  126. metadata +26 -4
@@ -97,12 +97,116 @@
97
97
 
98
98
 
99
99
 
100
+
101
+ <h2>
102
+ Instance Method Summary
103
+ <small><a href="#" class="summary_toggle">collapse</a></small>
104
+ </h2>
105
+
106
+ <ul class="summary">
107
+
108
+ <li class="public ">
109
+ <span class="summary_signature">
110
+
111
+ <a href="top-level-namespace.html#add_options-instance_method" title="#add_options (instance method)">#<strong>add_options</strong>(type, cmd) &#x21d2; Object </a>
112
+
113
+
114
+
115
+ </span>
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+ <span class="summary_desc"><div class='inline'><p>Add presets of flags and switches to a command.</p>
126
+ </div></span>
127
+
128
+ </li>
100
129
 
130
+
131
+ </ul>
132
+
133
+
134
+
135
+
136
+ <div id="instance_method_details" class="method_details_list">
137
+ <h2>Instance Method Details</h2>
138
+
139
+
140
+ <div class="method_details first">
141
+ <h3 class="signature first" id="add_options-instance_method">
142
+
143
+ #<strong>add_options</strong>(type, cmd) &#x21d2; <tt><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></tt>
144
+
145
+
146
+
147
+
148
+
149
+ </h3><div class="docstring">
150
+ <div class="discussion">
151
+ <p>Add presets of flags and switches to a command.</p>
152
+
153
+ <p>:add_entry =&gt; --noauto, --note, --ask, --editor, --back</p>
154
+
155
+ <p>:search =&gt; --search, --case, --exact</p>
156
+
157
+ <p>:tag_filter =&gt; --tag, --bool, --not, --val</p>
158
+
159
+ <p>:date_filter =&gt; --before, --after, --from</p>
160
+
161
+
162
+ </div>
163
+ </div>
164
+ <div class="tags">
165
+ <p class="tag_title">Parameters:</p>
166
+ <ul class="param">
167
+
168
+ <li>
169
+
170
+ <span class='name'>type</span>
171
+
172
+
173
+ <span class='type'>(<tt><span class='object_link'><a href="Symbol.html" title="Symbol (class)">Symbol</a></span></tt>)</span>
174
+
175
+
176
+
177
+ &mdash;
178
+ <div class='inline'><p>The type</p>
179
+ </div>
180
+
181
+ </li>
182
+
183
+ <li>
184
+
185
+ <span class='name'>cmd</span>
186
+
187
+
188
+ <span class='type'></span>
189
+
190
+
191
+
192
+ &mdash;
193
+ <div class='inline'><p>The GLI command to which the options will be added</p>
194
+ </div>
195
+
196
+ </li>
197
+
198
+ </ul>
199
+
200
+
201
+ </div>
202
+ </div>
203
+
204
+ </div>
101
205
 
102
206
  </div>
103
207
 
104
208
  <div id="footer">
105
- Generated on Mon Feb 14 10:46:50 2022 by
209
+ Generated on Thu Feb 17 13:05:18 2022 by
106
210
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
211
  0.9.27 (ruby-3.0.1).
108
212
  </div>
data/doing.gemspec CHANGED
@@ -44,5 +44,6 @@ spec = Gem::Specification.new do |s|
44
44
  s.add_runtime_dependency('tty-screen', '~> 0.8', '>= 0.8.1')
45
45
  s.add_runtime_dependency('parslet', '~> 2.0', '>= 2.0.0')
46
46
  s.add_runtime_dependency('plist', '~> 3.6', '>= 3.6.0')
47
+ s.add_runtime_dependency('sys-uname', '~> 1.2', '>= 1.2.2')
47
48
  # s.add_runtime_dependency('amatch', '~> 0.4', '>= 0.4.0')
48
49
  end
data/doing.rdoc CHANGED
@@ -5,7 +5,7 @@ record of what you've been doing, complete with tag-based time tracking. The
5
5
  command line tool allows you to add entries, annotate with tags and notes, and
6
6
  view your entries with myriad options, with a focus on a "natural" language syntax.
7
7
 
8
- v2.1.27
8
+ v2.1.31pre
9
9
 
10
10
  === Global Options
11
11
  === --config_file arg
@@ -440,10 +440,10 @@ Display a formatted list of changes in recent versions.
440
440
 
441
441
  Look up a specific version. Specify versions as "MAJ.MIN.PATCH", MIN
442
442
  and PATCH are optional. Use > or < to see all changes since or prior
443
- to a version.
443
+ to a version. Wildcards (*?) accepted unless using < or >.
444
444
 
445
445
  [Default Value] None
446
- [Must Match] (?-mix:^(?:(?:(?:[<>=]|p(?:rior)|b(?:efore)|o(?:lder)|s(?:ince)|a(?:fter)|n(?:ewer))? *[\d.*?]+ *)+|(?:[\d.]+ *-+ *[\d.]+))$)
446
+ [Must Match] (?-mix:^(?:(?:(?:[<>=]+|p(?:rior)|b(?:efore)|o(?:lder)|s(?:ince)|a(?:fter)|n(?:ewer))? *[0-9.*?]+ *)+|(?:[\d.]+ *(?:-|to)+ *[0-9.]+))$)
447
447
 
448
448
 
449
449
  ===== -s|--search arg
@@ -454,6 +454,14 @@ Show changelogs matching search terms (uses pattern-based searching).
454
454
  [Default Value] None
455
455
 
456
456
 
457
+ ===== --sort ORDER
458
+
459
+ Sort order (asc/desc)
460
+
461
+ [Default Value] desc
462
+ [Must Match] (?i-mx:^(?:a(?:sc)?|d(?:esc)?)$)
463
+
464
+
457
465
  ===== -C|--changes
458
466
  Only output changes, no version numbers, headers, or dates
459
467
 
@@ -464,11 +472,21 @@ Display all versions
464
472
 
465
473
 
466
474
 
475
+ ===== -i|--interactive
476
+ Open changelog in interactive viewer
477
+
478
+
479
+
467
480
  ===== -m|--md|--markdown
468
481
  Output raw Markdown
469
482
 
470
483
 
471
484
 
485
+ ===== --render
486
+ Force rendered output
487
+
488
+
489
+
472
490
  ==== Command: <tt>colors </tt>
473
491
  List available color variables for configuration templates and views
474
492
 
@@ -488,26 +506,42 @@ Disable Doing commands
488
506
 
489
507
  [Default Command] add
490
508
  ==== Command: <tt>completion </tt>
491
- Generate shell completion scripts
509
+ Generate shell completion scripts for doing
492
510
 
493
511
  Generates the necessary scripts to add command line completion to various shells,
494
512
  so typing 'doing' and hitting tab will offer completions of subcommands and their options.
495
513
  ===== Options
496
- ===== -f|--file PATH
514
+ ===== -t|--type arg
497
515
 
498
- File to write output to
516
+ Deprecated, specify shell as argument to subcommand
499
517
 
500
- [Default Value] STDOUT
518
+ [Default Value] None
519
+ [Must Match] (?i-mx:^(?:[bzf](?:[ai]?sh)?|all)$)
501
520
 
502
521
 
503
- ===== -t|--type SHELL
522
+ ===== Commands
523
+ ====== Command: <tt>generate [zsh|bash|fish|all]</tt>
524
+ Generate completion scripts, including custom plugins and command options
504
525
 
505
- Shell to generate for (bash, zsh, fish)
526
+ Argument specifies which shell to install for: zsh, bash, fish, all
527
+ ======= Options
528
+ ======= -f|--file PATH
506
529
 
507
- [Default Value] zsh
508
- [Must Match] (?i-mx:^(?:[bzf](?:[ai]?sh)?|all)$)
530
+ Alternative file to write output to
531
+
532
+ [Default Value] None
533
+ Argument specifies which shell to install for: zsh, bash, fish, all
534
+
535
+ ======= --stdout
536
+ Output result to STDOUT only
509
537
 
510
538
 
539
+
540
+ ====== Command: <tt>install [zsh|bash|fish]</tt>
541
+ Install default completion scripts
542
+
543
+ Argument specifies which shell to install for: zsh, bash, fish, or all
544
+ [Default Command] generate
511
545
  ==== Command: <tt>config </tt>
512
546
  Edit the configuration file or output a value from it
513
547
 
@@ -1161,35 +1195,6 @@ Force exact search string matching (case sensitive)
1161
1195
 
1162
1196
 
1163
1197
 
1164
- ==== Command: <tt>later ENTRY</tt>
1165
- Add an item to the Later section
1166
-
1167
-
1168
- ===== Options
1169
- ===== -b|--back|--started DATE_STRING
1170
-
1171
- Backdate start time to date string [4pm|20m|2h|yesterday noon]
1172
-
1173
- [Default Value] None
1174
-
1175
-
1176
- ===== -n|--note TEXT
1177
-
1178
- Note
1179
-
1180
- [Default Value] None
1181
-
1182
-
1183
- ===== --ask
1184
- Prompt for note via multi-line input
1185
-
1186
-
1187
-
1188
- ===== -e|--editor
1189
- Edit entry with vim
1190
-
1191
-
1192
-
1193
1198
  ==== Command: <tt>mark|flag </tt>
1194
1199
  Mark last entry as flagged
1195
1200
 
@@ -1541,7 +1546,7 @@ Show time totals at the end of output
1541
1546
  ==== Command: <tt>open </tt>
1542
1547
  Open the "doing" file in an editor
1543
1548
 
1544
- `doing open` defaults to using the editors->doing_file setting
1549
+ `doing open` defaults to using the editors.doing_file setting
1545
1550
  in /Users/ttscoff/.config/doing/config.yml (TaskPaper).
1546
1551
  ===== Options
1547
1552
  ===== -a|--app APP_NAME
data/example_plugin.rb CHANGED
@@ -54,7 +54,7 @@ module Doing
54
54
  ## automatically be added for the user to override
55
55
  ## The config key will be available at:
56
56
  ##
57
- ## wwid.config['export_templates'][PLUGIN_NAME]
57
+ ## Doing.config.settings['export_templates'][PLUGIN_NAME]
58
58
  ##
59
59
  ## config: (optional) A Hash which will be
60
60
  ## added to the main configuration in the plugins section.
@@ -65,7 +65,7 @@ module Doing
65
65
  ##
66
66
  ## The configuration keys will be available at:
67
67
  ##
68
- ## wwid.config['plugins'][PLUGIN_NAME][KEY]
68
+ ## Doing.config.settings['plugins'][PLUGIN_NAME][KEY]
69
69
  ##
70
70
  ## Method to return plugin settings (required)
71
71
  ##
@@ -125,6 +125,8 @@ module Doing
125
125
  def self.render(wwid, items, variables: {})
126
126
  return unless items.good?
127
127
 
128
+ config = Doing.config.settings
129
+
128
130
  # the :options key includes the flags passed to the
129
131
  # command that called the plugin use `puts
130
132
  # variables.inspect` to see properties and methods
@@ -162,8 +164,8 @@ module Doing
162
164
  title = i.title.gsub(/@/, 'hashtag ')
163
165
  tpl = template('say')
164
166
 
165
- if wwid.config['export_templates'].key?('say')
166
- cfg_tpl = wwid.config['export_templates']['say']
167
+ if config['export_templates'].key?('say')
168
+ cfg_tpl = config['export_templates']['say']
167
169
  tpl = cfg_tpl if cfg_tpl.good?
168
170
  end
169
171
  output = tpl.dup
@@ -188,7 +190,7 @@ module Doing
188
190
  Doing.logger.info('Spoke the last entry. Did you hear it?')
189
191
 
190
192
  # This export runs a command for fun, most plugins won't
191
- voice = wwid.config['plugins']['say']['say_voice'] || 'Alex'
193
+ voice = config['plugins']['say']['say_voice'] || 'Alex'
192
194
  `say -v "#{voice}" "#{output}"`
193
195
 
194
196
  # Return the result (don't output to terminal with puts or print)
@@ -18,7 +18,7 @@ function _doing() {
18
18
  'changelog:List recent changes in Doing'
19
19
  'colors:List available color variables for configuration templates and views'
20
20
  'commands:Enable and disable Doing commands'
21
- 'completion:Generate shell completion scripts'
21
+ 'completion:Generate shell completion scripts for doing'
22
22
  'config:Edit the configuration file or output a value from it'
23
23
  'done:Add a completed item with @done(date)'
24
24
  'did:Add a completed item with @done(date)'
@@ -28,7 +28,6 @@ function _doing() {
28
28
  'help:Shows a list of commands or help for one command'
29
29
  'import:Import entries from an external source'
30
30
  'last:Show the last entry'
31
- 'later:Add an item to the Later section'
32
31
  'mark:Mark last entry as flagged'
33
32
  'flag:Mark last entry as flagged'
34
33
  'meanwhile:Finish any running @meanwhile tasks and optionally create a new one'
@@ -89,10 +88,10 @@ function _doing() {
89
88
  args=( {-a,--archive}"[Archive entries]" "(--bool=)--bool=}[Boolean used to combine multiple tags]" "(--case=)--case=}[Case sensitivity for search string matching [(c)ase-sensitive]" {-i,--interactive}"[Select item(s) to cancel from a menu of matching entries]" "(--not)--not}[Cancel items that *dont* match search/tag filterst* match search/tag filters]" {-s,--section=}"[Section]" "(--search=)--search=}[Filter entries using a search query]" "(--tag=)--tag=}[Filter entries by tag]" {-u,--unfinished}"[Cancel last entry]" "(--val=)--val=}[Perform a tag value query]" {-x,--exact}"[Force exact search string matching]" )
90
89
  ;;
91
90
  changes)
92
- args=( {-C,--changes}"[Only output changes]" {-a,--all}"[Display all versions]" {-l,--lookup=}"[Look up a specific version]" "(--markdown)--markdown}[Output raw Markdown]" {-s,--search=}"[Show changelogs matching search terms]" )
91
+ args=( {-C,--changes}"[Only output changes]" {-a,--all}"[Display all versions]" {-i,--interactive}"[Open changelog in interactive viewer]" {-l,--lookup=}"[Look up a specific version]" "(--markdown)--markdown}[Output raw Markdown]" "(--render)--render}[Force rendered output]" {-s,--search=}"[Show changelogs matching search terms]" "(--sort=)--sort=}[Sort order]" )
93
92
  ;;
94
93
  changelog)
95
- args=( {-C,--changes}"[Only output changes]" {-a,--all}"[Display all versions]" {-l,--lookup=}"[Look up a specific version]" "(--markdown)--markdown}[Output raw Markdown]" {-s,--search=}"[Show changelogs matching search terms]" )
94
+ args=( {-C,--changes}"[Only output changes]" {-a,--all}"[Display all versions]" {-i,--interactive}"[Open changelog in interactive viewer]" {-l,--lookup=}"[Look up a specific version]" "(--markdown)--markdown}[Output raw Markdown]" "(--render)--render}[Force rendered output]" {-s,--search=}"[Show changelogs matching search terms]" "(--sort=)--sort=}[Sort order]" )
96
95
  ;;
97
96
  colors)
98
97
  args=( )
@@ -101,7 +100,7 @@ function _doing() {
101
100
  args=( )
102
101
  ;;
103
102
  completion)
104
- args=( {-f,--file=}"[File to write output to]" {-t,--type=}"[Shell to generate for]" )
103
+ args=( {-t,--type=}"[Deprecated]" )
105
104
  ;;
106
105
  config)
107
106
  args=( {-d,--dump}"[DEPRECATED]" {-u,--update}"[DEPRECATED]" )
@@ -130,9 +129,6 @@ function _doing() {
130
129
  last)
131
130
  args=( "(--bool=)--bool=}[Boolean used to combine multiple tags]" "(--case=)--case=}[Case sensitivity for search string matching [(c)ase-sensitive]" "(--config_template=)--config_template=}[Output using a template from configuration]" {-d,--delete}"[Delete the last entry]" "(--duration)--duration}[Show elapsed time if entry is not tagged @done]" {-e,--editor}"[Edit entry with vim]" {-h,--hilite}"[Highlight search matches in output]" "(--not)--not}[Show items that *dont* match search/tag filterst* match search/tag filters]" {-s,--section=}"[Specify a section]" "(--search=)--search=}[Filter entries using a search query]" "(--tag=)--tag=}[Filter entries by tag]" "(--template=)--template=}[Override output format with a template string containing %placeholders]" "(--val=)--val=}[Perform a tag value query]" {-x,--exact}"[Force exact search string matching]" )
132
131
  ;;
133
- later)
134
- args=( "(--ask)--ask}[Prompt for note via multi-line input]" "(--started=)--started=}[Backdate start time to date string [4pm|20m|2h|yesterday noon]]" {-e,--editor}"[Edit entry with vim]" {-n,--note=}"[Note]" )
135
- ;;
136
132
  mark)
137
133
  args=( "(--bool=)--bool=}[Boolean used to combine multiple tags]" {-c,--count=}"[How many recent entries to tag]" "(--case=)--case=}[Case sensitivity for search string matching [(c)ase-sensitive]" {-d,--date}"[Include current date/time with tag]" "(--force)--force}[Dont ask permission to flag all entries when count is 0t ask permission to flag all entries when count is 0]" {-i,--interactive}"[Select item(s) to flag from a menu of matching entries]" "(--not)--not}[Flag items that *dont* match search/tag filterst* match search/tag filters]" {-r,--remove}"[Remove flag]" {-s,--section=}"[Section]" "(--search=)--search=}[Filter entries using a search query]" "(--tag=)--tag=}[Filter entries by tag]" {-u,--unfinished}"[Flag last entry]" "(--val=)--val=}[Perform a tag value query]" {-x,--exact}"[Force exact search string matching]" )
138
134
  ;;
@@ -61,9 +61,9 @@ _doing_cancel() {
61
61
  _doing_changes() {
62
62
 
63
63
  if [[ "$token" == --* ]]; then
64
- COMPREPLY=( $( compgen -W '--changes --all --lookup --markdown --search' -- $token ) )
64
+ COMPREPLY=( $( compgen -W '--changes --all --interactive --lookup --markdown --render --search --sort' -- $token ) )
65
65
  elif [[ "$token" == -* ]]; then
66
- COMPREPLY=( $( compgen -W '-C -a -l -s --changes --all --lookup --markdown --search' -- $token ) )
66
+ COMPREPLY=( $( compgen -W '-C -a -i -l -s --changes --all --interactive --lookup --markdown --render --search --sort' -- $token ) )
67
67
 
68
68
  fi
69
69
  }
@@ -71,9 +71,9 @@ _doing_changes() {
71
71
  _doing_completion() {
72
72
 
73
73
  if [[ "$token" == --* ]]; then
74
- COMPREPLY=( $( compgen -W '--file --type' -- $token ) )
74
+ COMPREPLY=( $( compgen -W '--type' -- $token ) )
75
75
  elif [[ "$token" == -* ]]; then
76
- COMPREPLY=( $( compgen -W '-f -t --file --type' -- $token ) )
76
+ COMPREPLY=( $( compgen -W '-t --type' -- $token ) )
77
77
 
78
78
  fi
79
79
  }
@@ -148,16 +148,6 @@ _doing_last() {
148
148
  fi
149
149
  }
150
150
 
151
- _doing_later() {
152
-
153
- if [[ "$token" == --* ]]; then
154
- COMPREPLY=( $( compgen -W '--ask --started --editor --note' -- $token ) )
155
- elif [[ "$token" == -* ]]; then
156
- COMPREPLY=( $( compgen -W '-e -n --ask --started --editor --note' -- $token ) )
157
-
158
- fi
159
- }
160
-
161
151
  _doing_mark() {
162
152
 
163
153
  if [[ "$token" == --* ]]; then
@@ -466,7 +456,6 @@ _doing()
466
456
  elif [[ $last =~ (help) ]]; then _doing_help
467
457
  elif [[ $last =~ (import) ]]; then _doing_import
468
458
  elif [[ $last =~ (last) ]]; then _doing_last
469
- elif [[ $last =~ (later) ]]; then _doing_later
470
459
  elif [[ $last =~ (mark|flag) ]]; then _doing_mark
471
460
  elif [[ $last =~ (meanwhile) ]]; then _doing_meanwhile
472
461
  elif [[ $last =~ (note) ]]; then _doing_note
@@ -143,7 +143,7 @@ complete -xc doing -n '__fish_doing_needs_command' -a 'cancel' -d End\ last\ X\
143
143
  complete -xc doing -n '__fish_doing_needs_command' -a 'changes changelog' -d List\ recent\ changes\ in\ Doing
144
144
  complete -xc doing -n '__fish_doing_needs_command' -a 'colors' -d List\ available\ color\ variables\ for\ configuration\ templates\ and\ views
145
145
  complete -xc doing -n '__fish_doing_needs_command' -a 'commands' -d Enable\ and\ disable\ Doing\ commands
146
- complete -xc doing -n '__fish_doing_needs_command' -a 'completion' -d Generate\ shell\ completion\ scripts
146
+ complete -xc doing -n '__fish_doing_needs_command' -a 'completion' -d Generate\ shell\ completion\ scripts\ for\ doing
147
147
  complete -xc doing -n '__fish_doing_needs_command' -a 'config' -d Edit\ the\ configuration\ file\ or\ output\ a\ value\ from\ it
148
148
  complete -xc doing -n '__fish_doing_needs_command' -a 'done did' -d Add\ a\ completed\ item\ with\ @done\(date\)
149
149
  complete -xc doing -n '__fish_doing_needs_command' -a 'finish' -d Mark\ last\ X\ entries\ as\ @done
@@ -151,7 +151,6 @@ complete -xc doing -n '__fish_doing_needs_command' -a 'grep search' -d Search\ f
151
151
  complete -xc doing -n '__fish_doing_needs_command' -a 'help' -d Shows\ a\ list\ of\ commands\ or\ help\ for\ one\ command
152
152
  complete -xc doing -n '__fish_doing_needs_command' -a 'import' -d Import\ entries\ from\ an\ external\ source
153
153
  complete -xc doing -n '__fish_doing_needs_command' -a 'last' -d Show\ the\ last\ entry
154
- complete -xc doing -n '__fish_doing_needs_command' -a 'later' -d Add\ an\ item\ to\ the\ Later\ section
155
154
  complete -xc doing -n '__fish_doing_needs_command' -a 'mark flag' -d Mark\ last\ entry\ as\ flagged
156
155
  complete -xc doing -n '__fish_doing_needs_command' -a 'meanwhile' -d Finish\ any\ running\ @meanwhile\ tasks\ and\ optionally\ create\ a\ new\ one
157
156
  complete -xc doing -n '__fish_doing_needs_command' -a 'note' -d Add\ a\ note\ to\ the\ last\ entry
@@ -227,11 +226,13 @@ complete -c doing -l val -f -r -n '__fish_doing_using_command cancel' -d Perfor
227
226
  complete -c doing -l exact -s x -f -n '__fish_doing_using_command cancel' -d Force\ exact\ search\ string\ matching
228
227
  complete -c doing -l changes -s C -f -n '__fish_doing_using_command changes changelog' -d Only\ output\ changes
229
228
  complete -c doing -l all -s a -f -n '__fish_doing_using_command changes changelog' -d Display\ all\ versions
229
+ complete -c doing -l interactive -s i -f -n '__fish_doing_using_command changes changelog' -d Open\ changelog\ in\ interactive\ viewer
230
230
  complete -c doing -l lookup -s l -f -r -n '__fish_doing_using_command changes changelog' -d Look\ up\ a\ specific\ version
231
231
  complete -c doing -l markdown -f -n '__fish_doing_using_command changes changelog' -d Output\ raw\ Markdown
232
+ complete -c doing -l render -f -n '__fish_doing_using_command changes changelog' -d Force\ rendered\ output
232
233
  complete -c doing -l search -s s -f -r -n '__fish_doing_using_command changes changelog' -d Show\ changelogs\ matching\ search\ terms
233
- complete -c doing -l file -s f -f -r -n '__fish_doing_using_command completion' -d File\ to\ write\ output\ to
234
- complete -c doing -l type -s t -f -r -n '__fish_doing_using_command completion' -d Shell\ to\ generate\ for
234
+ complete -c doing -l sort -f -r -n '__fish_doing_using_command changes changelog' -d Sort\ order
235
+ complete -c doing -l type -s t -f -r -n '__fish_doing_using_command completion' -d Deprecated
235
236
  complete -c doing -l dump -s d -f -n '__fish_doing_using_command config' -d DEPRECATED
236
237
  complete -c doing -l update -s u -f -n '__fish_doing_using_command config' -d DEPRECATED
237
238
  complete -c doing -l noauto -s X -f -n '__fish_doing_using_command done did' -d Exclude\ auto\ tags\ and\ default\ tags
@@ -315,10 +316,6 @@ complete -c doing -l tag -f -r -n '__fish_doing_using_command last' -d Filter\
315
316
  complete -c doing -l template -f -r -n '__fish_doing_using_command last' -d Override\ output\ format\ with\ a\ template\ string\ containing\ \%placeholders
316
317
  complete -c doing -l val -f -r -n '__fish_doing_using_command last' -d Perform\ a\ tag\ value\ query
317
318
  complete -c doing -l exact -s x -f -n '__fish_doing_using_command last' -d Force\ exact\ search\ string\ matching
318
- complete -c doing -l ask -f -n '__fish_doing_using_command later' -d Prompt\ for\ note\ via\ multi-line\ input
319
- complete -c doing -l started -f -r -n '__fish_doing_using_command later' -d Backdate\ start\ time\ to\ date\ string\ \[4pm\|20m\|2h\|yesterday\ noon\]
320
- complete -c doing -l editor -s e -f -n '__fish_doing_using_command later' -d Edit\ entry\ with\ vim
321
- complete -c doing -l note -s n -f -r -n '__fish_doing_using_command later' -d Note
322
319
  complete -c doing -l bool -f -r -n '__fish_doing_using_command mark flag' -d Boolean\ used\ to\ combine\ multiple\ tags
323
320
  complete -c doing -l count -s c -f -r -n '__fish_doing_using_command mark flag' -d How\ many\ recent\ entries\ to\ tag
324
321
  complete -c doing -l case -f -r -n '__fish_doing_using_command mark flag' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
@@ -558,7 +555,7 @@ complete -c doing -l template -f -r -n '__fish_doing_using_command yesterday' -
558
555
  complete -c doing -l totals -f -n '__fish_doing_using_command yesterday' -d Show\ time\ totals\ at\ the\ end\ of\ output
559
556
  complete -f -c doing -s o -l output -x -n '__fish_doing_using_command grep search on select show since today view yesterday' -a '(__fish_doing_export_plugin)'
560
557
  complete -f -c doing -s b -l bool -x -n '__fish_doing_using_command again resume archive move autotag cancel finish grep search last mark flag note reset begin rotate show tag tags view wiki' -a 'and or not pattern'
561
- complete -f -c doing -l case -x -n '__fish_doing_using_command again resume archive move cancel finish grep search import last mark flag note reset begin rotate select show show tag tags tags view' -a 'case-sensitive ignore smart'
558
+ complete -f -c doing -l case -x -n '__fish_doing_using_command again resume archive move cancel changes changelog finish grep search import last mark flag note reset begin rotate select show show tag tags tags view' -a 'case-sensitive ignore smart'
562
559
  complete -f -c doing -l tag_sort -x -n '__fish_doing_using_command grep search on recent show since today view yesterday' -a 'name time'
563
560
  complete -f -c doing -l tag_order -x -n '__fish_doing_using_command show view yesterday' -a 'asc desc'
564
561
  complete -f -c doing -s a -l age -x -n '__fish_doing_using_command show view' -a 'oldest newest'
@@ -0,0 +1,117 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ ## Add presets of flags and switches to a command.
5
+ ##
6
+ ## :add_entry => --noauto, --note, --ask, --editor, --back
7
+ ##
8
+ ## :search => --search, --case, --exact
9
+ ##
10
+ ## :tag_filter => --tag, --bool, --not, --val
11
+ ##
12
+ ## :date_filter => --before, --after, --from
13
+ ##
14
+ ## @param type [Symbol] The type
15
+ ## @param cmd The GLI command to which the options will be added
16
+ ##
17
+ def add_options(type, cmd)
18
+ cmd_name = cmd.name.to_s
19
+ action = case cmd_name
20
+ when /again/
21
+ 'Repeat'
22
+ when /grep/
23
+ 'Search'
24
+ when /mark/
25
+ 'Flag'
26
+ when /(last|tags|view)/
27
+ 'Show'
28
+ else
29
+ cmd_name.capitalize
30
+ end
31
+
32
+ case type
33
+ when :add_entry
34
+ cmd.desc 'Exclude auto tags and default tags'
35
+ cmd.switch %i[X noauto], default_value: false, negatable: false
36
+
37
+ cmd.desc 'Include a note'
38
+ cmd.arg_name 'TEXT'
39
+ cmd.flag %i[n note]
40
+
41
+ cmd.desc 'Prompt for note via multi-line input'
42
+ cmd.switch %i[ask], negatable: false, default_value: false
43
+
44
+ cmd.desc "Edit entry with #{Doing::Util.default_editor}"
45
+ cmd.switch %i[e editor], negatable: false, default_value: false
46
+
47
+ cmd.desc 'Backdate start date for new entry to date string [4pm|20m|2h|yesterday noon]'
48
+ cmd.arg_name 'DATE_STRING'
49
+ cmd.flag %i[b back started], type: DateBeginString
50
+ when :search
51
+ cmd.desc 'Filter entries using a search query, surround with slashes for regex (e.g. "/query.*/"),
52
+ start with single quote for exact match ("\'query")'
53
+ cmd.arg_name 'QUERY'
54
+ cmd.flag [:search]
55
+
56
+ cmd.desc 'Case sensitivity for search string matching [(c)ase-sensitive, (i)gnore, (s)mart]'
57
+ cmd.arg_name 'TYPE'
58
+ cmd.flag [:case], must_match: REGEX_CASE,
59
+ default_value: Doing.settings.dig('search', 'case').normalize_case,
60
+ type: CaseSymbol
61
+
62
+ cmd.desc 'Force exact search string matching (case sensitive)'
63
+ cmd.switch %i[x exact], default_value: Doing.config.exact_match?, negatable: Doing.config.exact_match?
64
+ when :tag_filter
65
+ cmd.desc 'Filter entries by tag. Combine multiple tags with a comma. Wildcards allowed (*, ?)'
66
+ cmd.arg_name 'TAG'
67
+ cmd.flag [:tag], type: TagArray
68
+
69
+ cmd.desc 'Perform a tag value query ("@done > two hours ago" or "@progress < 50").
70
+ May be used multiple times, combined with --bool'
71
+ cmd.arg_name 'QUERY'
72
+ cmd.flag [:val], multiple: true, must_match: REGEX_VALUE_QUERY
73
+
74
+ cmd.desc "#{action} items that *don't* match search/tag filters"
75
+ cmd.switch [:not], default_value: false, negatable: false
76
+
77
+ cmd.desc 'Boolean used to combine multiple tags. Use PATTERN to parse + and - as booleans'
78
+ cmd.arg_name 'BOOLEAN'
79
+ cmd.flag [:bool], must_match: REGEX_BOOL,
80
+ default_value: :pattern,
81
+ type: BooleanSymbol
82
+ when :date_filter
83
+ if action =~ /Archive/
84
+ cmd.desc 'Archive entries older than date (natural language).'
85
+ else
86
+ cmd.desc "#{action} entries older than date (natural language). If this is only a time (8am, 1:30pm, 15:00), all
87
+ dates will be included, but entries will be filtered by time of day"
88
+ end
89
+ cmd.arg_name 'DATE_STRING'
90
+ cmd.flag [:before], type: DateBeginString
91
+
92
+ if action =~ /Archive/
93
+ cmd.desc 'Archive entries newer than date (natural language).'
94
+ else
95
+ cmd.desc "#{action} entries newer than date (natural language). If this is only a time (8am, 1:30pm, 15:00), all
96
+ dates will be included, but entries will be filtered by time of day"
97
+ end
98
+ cmd.arg_name 'DATE_STRING'
99
+ cmd.flag [:after], type: DateEndString
100
+
101
+ if action =~ /Archive/
102
+ cmd.desc %(
103
+ Date range (natural language) to archive: `doing archive --from "1/1/21 to 12/31/21"`.
104
+ )
105
+ else
106
+ cmd.desc %(
107
+ Date range (natural language) to #{action.downcase}, or a single day to filter on.
108
+ To specify a range, use "to": `doing #{cmd_name} --from "monday 8am to friday 5pm"`.
109
+
110
+ If values are only time(s) (6am to noon) all dates will be included, but entries will be filtered
111
+ by time of day.
112
+ )
113
+ end
114
+ cmd.arg_name 'DATE_OR_RANGE'
115
+ cmd.flag [:from], type: DateRangeString
116
+ end
117
+ end
@@ -2,3 +2,19 @@
2
2
 
3
3
  require_relative 'tags'
4
4
  require_relative 'nested_hash'
5
+
6
+ class ::Array
7
+ ##
8
+ ## Force UTF-8 encoding of strings in array
9
+ ##
10
+ ## @return [Array] Encoded lines
11
+ ##
12
+ def utf8
13
+ c = self.class
14
+ if String.method_defined? :force_encoding
15
+ replace c.new(map(&:utf8))
16
+ else
17
+ self
18
+ end
19
+ end
20
+ end
@@ -92,7 +92,7 @@ module Doing
92
92
  out << members.map(&:to_s).join("\n")
93
93
  end
94
94
 
95
- out.join("")
95
+ out.join("\n")
96
96
  end
97
97
 
98
98
  private