doing 2.1.9 → 2.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/.yardoc/checksums +5 -5
  3. data/.yardoc/object_types +0 -0
  4. data/.yardoc/objects/root.dat +0 -0
  5. data/CHANGELOG.md +6 -0
  6. data/Gemfile.lock +1 -1
  7. data/README.md +1 -1
  8. data/Rakefile +12 -1
  9. data/bin/doing +12 -2
  10. data/docs/doc/Array.html +1 -1
  11. data/docs/doc/BooleanTermParser/Clause.html +1 -1
  12. data/docs/doc/BooleanTermParser/Operator.html +1 -1
  13. data/docs/doc/BooleanTermParser/Query.html +1 -1
  14. data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
  15. data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
  16. data/docs/doc/BooleanTermParser.html +1 -1
  17. data/docs/doc/Doing/Color.html +1 -1
  18. data/docs/doc/Doing/Completion.html +1 -1
  19. data/docs/doc/Doing/Configuration.html +1 -1
  20. data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
  21. data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
  22. data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
  23. data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
  24. data/docs/doc/Doing/Errors/NoResults.html +1 -1
  25. data/docs/doc/Doing/Errors/PluginException.html +1 -1
  26. data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
  27. data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
  28. data/docs/doc/Doing/Errors.html +1 -1
  29. data/docs/doc/Doing/Hooks.html +1 -1
  30. data/docs/doc/Doing/Item.html +1 -1
  31. data/docs/doc/Doing/Items.html +1 -1
  32. data/docs/doc/Doing/LogAdapter.html +1 -1
  33. data/docs/doc/Doing/Note.html +1 -1
  34. data/docs/doc/Doing/Pager.html +1 -1
  35. data/docs/doc/Doing/Plugins.html +1 -1
  36. data/docs/doc/Doing/Prompt.html +1 -1
  37. data/docs/doc/Doing/Section.html +1 -1
  38. data/docs/doc/Doing/TemplateString.html +2 -2
  39. data/docs/doc/Doing/Util/Backup.html +1 -1
  40. data/docs/doc/Doing/Util.html +1 -1
  41. data/docs/doc/Doing/WWID.html +53 -8
  42. data/docs/doc/Doing.html +2 -2
  43. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  44. data/docs/doc/GLI/Commands.html +1 -1
  45. data/docs/doc/GLI.html +1 -1
  46. data/docs/doc/Hash.html +1 -1
  47. data/docs/doc/PhraseParser/Operator.html +1 -1
  48. data/docs/doc/PhraseParser/PhraseClause.html +1 -1
  49. data/docs/doc/PhraseParser/Query.html +1 -1
  50. data/docs/doc/PhraseParser/QueryParser.html +1 -1
  51. data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
  52. data/docs/doc/PhraseParser/TermClause.html +1 -1
  53. data/docs/doc/PhraseParser.html +1 -1
  54. data/docs/doc/Status.html +1 -1
  55. data/docs/doc/String.html +97 -1
  56. data/docs/doc/Symbol.html +36 -2
  57. data/docs/doc/Time.html +1 -1
  58. data/docs/doc/_index.html +1 -1
  59. data/docs/doc/file.README.html +2 -2
  60. data/docs/doc/index.html +2 -2
  61. data/docs/doc/method_list.html +243 -219
  62. data/docs/doc/top-level-namespace.html +1 -1
  63. data/docs/index.md +1 -1
  64. data/doing.rdoc +9 -2
  65. data/generate_completions.sh +1 -3
  66. data/lib/completion/_doing.zsh +1 -1
  67. data/lib/completion/doing.bash +2 -2
  68. data/lib/completion/doing.fish +2 -1
  69. data/lib/doing/completion/bash_completion.rb +2 -2
  70. data/lib/doing/completion/fish_completion.rb +2 -2
  71. data/lib/doing/completion/zsh_completion.rb +2 -2
  72. data/lib/doing/completion.rb +12 -2
  73. data/lib/doing/string.rb +20 -0
  74. data/lib/doing/symbol.rb +4 -0
  75. data/lib/doing/version.rb +1 -1
  76. data/lib/doing/wwid.rb +16 -15
  77. data/scripts/generate_bash_completions.rb +2 -2
  78. metadata +1 -1
@@ -102,7 +102,7 @@
102
102
  </div>
103
103
 
104
104
  <div id="footer">
105
- Generated on Tue Dec 21 12:36:35 2021 by
105
+ Generated on Tue Dec 21 14:44:17 2021 by
106
106
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
107
  0.9.26 (ruby-3.0.1).
108
108
  </div>
data/docs/index.md CHANGED
@@ -6,7 +6,7 @@ _If you're one of the rare people like me who find this useful, feel free to [bu
6
6
 
7
7
 
8
8
 
9
- The current version of `doing` is 2.1.5.
9
+ The current version of `doing` is 2.1.9.
10
10
 
11
11
  Find all of the documentation in the [doing wiki](https://github.com/ttscoff/doing/wiki).
12
12
 
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.9
8
+ v2.1.10
9
9
 
10
10
  === Global Options
11
11
  === --config_file arg
@@ -397,7 +397,7 @@ File to write output to
397
397
  Shell to generate for (bash, zsh, fish)
398
398
 
399
399
  [Default Value] zsh
400
- [Must Match] (?i-mx:^[bzf](?:[ai]?sh)?$)
400
+ [Must Match] (?i-mx:^(?:[bzf](?:[ai]?sh)?|all)$)
401
401
 
402
402
 
403
403
  ==== Command: <tt>config </tt>
@@ -2155,6 +2155,13 @@ View entries newer than date. If this is only a time (8am, 1:30pm, 15:00), all d
2155
2155
  [Default Value] None
2156
2156
 
2157
2157
 
2158
+ ===== --age AGE
2159
+
2160
+ Age (oldest|newest)
2161
+
2162
+ [Default Value] newest
2163
+
2164
+
2158
2165
  ===== -b|--bool BOOLEAN
2159
2166
 
2160
2167
  Tag boolean (AND,OR,NOT). Use PATTERN to parse + and - as booleans.
@@ -1,5 +1,3 @@
1
1
  #!/bin/bash
2
2
 
3
- bundle exec bin/doing completion --type fish --file lib/completion/doing.fish
4
- bundle exec bin/doing completion --type bash --file lib/completion/doing.bash
5
- bundle exec bin/doing completion --type zsh --file lib/completion/_doing.zsh
3
+ bundle exec bin/doing completion --type all
@@ -201,7 +201,7 @@ function _doing() {
201
201
  args=( {-f,--file=}"[Specify alternate doing file]" {-i,--interactive}"[Select from recent backups]" {-p,--prune=}"[Remove old backups]" {-r,--redo}"[Redo last undo]" )
202
202
  ;;
203
203
  view)
204
- args=( "(--after=)--after=}[View entries newer than date]" {-b,--bool=}"[Tag boolean]" "(--before=)--before=}[View entries older than date]" {-c,--count=}"[Count to display]" "(--case=)--case=}[Case sensitivity for search string matching [(c)ase-sensitive]" "(--color)--color}[Include colors in output]" "(--duration)--duration}[Show elapsed time on entries without @done tag]" "(--from=)--from=}[Date range to show]" {-i,--interactive}"[Select from a menu of matching entries to perform additional operations]" "(--not)--not}[Show items that *dont* match search stringt* match search string]" {-o,--output=}"[Output to export format]" "(--only_timed)--only_timed}[Only show items with recorded time intervals]" {-s,--section=}"[Section]" "(--search=)--search=}[Search filter]" {-t,--times}"[Show time intervals on @done tasks]" "(--tag=)--tag=}[Tag filter]" "(--tag_order=)--tag_order=}[Tag sort direction]" "(--tag_sort=)--tag_sort=}[Sort tags by]" "(--totals)--totals}[Show intervals with totals at the end of output]" {-x,--exact}"[Force exact search string matching]" )
204
+ args=( "(--after=)--after=}[View entries newer than date]" "(--age=)--age=}[Age]" {-b,--bool=}"[Tag boolean]" "(--before=)--before=}[View entries older than date]" {-c,--count=}"[Count to display]" "(--case=)--case=}[Case sensitivity for search string matching [(c)ase-sensitive]" "(--color)--color}[Include colors in output]" "(--duration)--duration}[Show elapsed time on entries without @done tag]" "(--from=)--from=}[Date range to show]" {-i,--interactive}"[Select from a menu of matching entries to perform additional operations]" "(--not)--not}[Show items that *dont* match search stringt* match search string]" {-o,--output=}"[Output to export format]" "(--only_timed)--only_timed}[Only show items with recorded time intervals]" {-s,--section=}"[Section]" "(--search=)--search=}[Search filter]" {-t,--times}"[Show time intervals on @done tasks]" "(--tag=)--tag=}[Tag filter]" "(--tag_order=)--tag_order=}[Tag sort direction]" "(--tag_sort=)--tag_sort=}[Sort tags by]" "(--totals)--totals}[Show intervals with totals at the end of output]" {-x,--exact}"[Force exact search string matching]" )
205
205
  ;;
206
206
  views)
207
207
  args=( {-c,--column}"[List in single column]" )
@@ -366,9 +366,9 @@ local words=$(doing views)
366
366
  IFS="$OLD_IFS"
367
367
 
368
368
  if [[ "$token" == --* ]]; then
369
- COMPREPLY=( $( compgen -W '--after --bool --before --count --case --color --duration --from --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --totals --exact' -- $token ) )
369
+ COMPREPLY=( $( compgen -W '--after --age --bool --before --count --case --color --duration --from --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --totals --exact' -- $token ) )
370
370
  elif [[ "$token" == -* ]]; then
371
- COMPREPLY=( $( compgen -W '-b -c -i -o -s -t -x --after --bool --before --count --case --color --duration --from --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --totals --exact' -- $token ) )
371
+ COMPREPLY=( $( compgen -W '-b -c -i -o -s -t -x --after --age --bool --before --count --case --color --duration --from --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --totals --exact' -- $token ) )
372
372
  else
373
373
  local nocasematchWasOff=0
374
374
  shopt nocasematch >/dev/null || nocasematchWasOff=1
@@ -371,6 +371,7 @@ complete -c doing -l interactive -s i -f -n '__fish_doing_using_command undo' -
371
371
  complete -c doing -l prune -s p -f -r -n '__fish_doing_using_command undo' -d Remove\ old\ backups
372
372
  complete -c doing -l redo -s r -f -n '__fish_doing_using_command undo' -d Redo\ last\ undo
373
373
  complete -c doing -l after -f -r -n '__fish_doing_using_command view' -d View\ entries\ newer\ than\ date
374
+ complete -c doing -l age -f -r -n '__fish_doing_using_command view' -d Age
374
375
  complete -c doing -l bool -s b -f -r -n '__fish_doing_using_command view' -d Tag\ boolean
375
376
  complete -c doing -l before -f -r -n '__fish_doing_using_command view' -d View\ entries\ older\ than\ date
376
377
  complete -c doing -l count -s c -f -r -n '__fish_doing_using_command view' -d Count\ to\ display
@@ -414,5 +415,5 @@ complete -f -c doing -s b -l bool -x -n '__fish_doing_using_command again resume
414
415
  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'
415
416
  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'
416
417
  complete -f -c doing -l tag_order -x -n '__fish_doing_using_command show view yesterday' -a 'asc desc'
417
- complete -f -c doing -s a -l age -x -n '__fish_doing_using_command show' -a 'oldest newest'
418
+ complete -f -c doing -s a -l age -x -n '__fish_doing_using_command show view' -a 'oldest newest'
418
419
  complete -f -c doing -s s -l section -x -n '__fish_doing_using_command again resume autotag cancel done did finish grep search import last mark flag meanwhile note now next on recent reset begin rotate select since tag tags today view wiki yesterday' -a '(__fish_doing_complete_sections)'
@@ -9,7 +9,7 @@ module Doing
9
9
  logic = []
10
10
 
11
11
  @commands.each_with_index do |cmd, i|
12
- @bar.advance
12
+ @bar.advance(status: cmd[:commands].first)
13
13
 
14
14
  data = get_help_sections(cmd[:commands].first)
15
15
 
@@ -167,7 +167,7 @@ module Doing
167
167
  data = get_help_sections
168
168
  @global_options = parse_options(data[:global_options])
169
169
  @commands = parse_commands(data[:commands])
170
- @bar = TTY::ProgressBar.new("\033[0;0;33mGenerating Bash completions: \033[0;35;40m[:bar]\033[0m", total: @commands.count, bar_format: :blade)
170
+ @bar = TTY::ProgressBar.new("\033[0;0;33mGenerating Bash completions: \033[0;35;40m[:bar] :status\033[0m", total: @commands.count, bar_format: :blade, status: 'Reading subcommands')
171
171
  @bar.resize(25)
172
172
  end
173
173
 
@@ -132,7 +132,7 @@ module Doing
132
132
  need_section = []
133
133
 
134
134
  @commands.each_with_index do |cmd, i|
135
- @bar.advance
135
+ @bar.advance(status: cmd[:commands].first)
136
136
  data = get_help_sections(cmd[:commands].first)
137
137
 
138
138
  if data[:synopsis].join(' ').strip.split(/ /).last =~ /(path|file)/i
@@ -200,7 +200,7 @@ module Doing
200
200
  data = get_help_sections
201
201
  @global_options = parse_options(data[:global_options])
202
202
  @commands = parse_commands(data[:commands])
203
- @bar = TTY::ProgressBar.new("\033[0;0;33mGenerating Fish completions: \033[0;35;40m[:bar]\033[0m", total: @commands.count, bar_format: :blade)
203
+ @bar = TTY::ProgressBar.new("\033[0;0;33mGenerating Fish completions: \033[0;35;40m[:bar] :status\033[0m", total: @commands.count, bar_format: :blade, status: 'processing subcommands')
204
204
  @bar.resize(25)
205
205
  end
206
206
 
@@ -96,7 +96,7 @@ module Doing
96
96
  out = []
97
97
 
98
98
  @commands.each_with_index do |cmd, i|
99
- @bar.advance
99
+ @bar.advance(status: cmd[:commands].first)
100
100
 
101
101
  data = get_help_sections(cmd[:commands].first)
102
102
  option_arr = []
@@ -127,7 +127,7 @@ module Doing
127
127
  data = get_help_sections
128
128
  @global_options = parse_options(data[:global_options])
129
129
  @commands = parse_commands(data[:commands])
130
- @bar = TTY::ProgressBar.new(" \033[0;0;33mGenerating Zsh completions: \033[0;35;40m[:bar]\033[0m", total: @commands.count, bar_format: :blade)
130
+ @bar = TTY::ProgressBar.new(" \033[0;0;33mGenerating Zsh completions: \033[0;35;40m[:bar] :status\033[0m", total: @commands.count, bar_format: :blade, status: 'processing subcommands')
131
131
  @bar.resize(25)
132
132
  end
133
133
 
@@ -19,11 +19,21 @@ module Doing
19
19
  # @param file [String] Path to save to, or 'stdout'
20
20
  #
21
21
  def generate_completion(type: 'zsh', file: 'stdout')
22
+ if type =~ /^all$/i
23
+ Doing.logger.log_now(:warn, 'Generating:', 'all completion types, will use default paths')
24
+ generate_completion(type: 'fish', file: 'lib/completion/doing.fish')
25
+ Doing.logger.warn('File written:', "fish completions written to lib/completion/doing.fish")
26
+ generate_completion(type: 'zsh', file: 'lib/completion/_doing.zsh')
27
+ Doing.logger.warn('File written:', "zsh completions written to lib/completion/_doing.zsh")
28
+ generate_completion(type: 'bash', file: 'lib/completion/doing.bash')
29
+ Doing.logger.warn('File written:', "bash completions written to lib/completion/doing.bash")
30
+ return
31
+ end
22
32
 
23
33
  generator = case type.to_s
24
- when /^f/
34
+ when /^f/i
25
35
  FishCompletions.new
26
- when /^b/
36
+ when /^b/i
27
37
  BashCompletions.new
28
38
  else
29
39
  ZshCompletions.new
data/lib/doing/string.rb CHANGED
@@ -263,6 +263,26 @@ module Doing
263
263
  number == 1 ? self : "#{self}s"
264
264
  end
265
265
 
266
+ ##
267
+ ## Convert an age string to a qualified type
268
+ ##
269
+ ## @return [Symbol] :oldest or :newest
270
+ ##
271
+ def normalize_age!(default = :newest)
272
+ replace normalize_age(default)
273
+ end
274
+
275
+ def normalize_age(default = :newest)
276
+ case self
277
+ when /^o/i
278
+ :oldest
279
+ when /^n/i
280
+ :newest
281
+ else
282
+ default
283
+ end
284
+ end
285
+
266
286
  ##
267
287
  ## Convert a sort order string to a qualified type
268
288
  ##
data/lib/doing/symbol.rb CHANGED
@@ -9,6 +9,10 @@ module Doing
9
9
  to_s.normalize_bool(default)
10
10
  end
11
11
 
12
+ def normalize_age(default = :newest)
13
+ to_s.normalize_age(default)
14
+ end
15
+
12
16
  def normalize_order(default = 'asc')
13
17
  to_s.normalize_order(default)
14
18
  end
data/lib/doing/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Doing
2
- VERSION = '2.1.9'
2
+ VERSION = '2.1.10'
3
3
  end
data/lib/doing/wwid.rb CHANGED
@@ -620,19 +620,19 @@ module Doing
620
620
  ## @param items [Array] The items to filter (if empty, filters all items)
621
621
  ## @param opt [Hash] The filter parameters
622
622
  ##
623
- ## @option opt [String] :section
624
- ## @option opt [Boolean] :unfinished
625
- ## @option opt [Array or String] :tag (Array or comma-separated string)
626
- ## @option opt [Symbol] :tag_bool (:and, :or, :not)
627
- ## @option opt [String] :search (string, optional regex with //)
628
- ## @option opt [Array] :date_filter [[Time]start, [Time]end]
629
- ## @option opt [Boolean] :only_timed
630
- ## @option opt [String] :before (Date/Time string, unparsed)
631
- ## @option opt [String] :after (Date/Time string, unparsed)
632
- ## @option opt [Boolean] :today
633
- ## @option opt [Boolean] :yesterday
634
- ## @option opt [Number] :count (Number to return)
635
- ## @option opt [String] :age ('old' or 'new')
623
+ ## @option opt [String] :section ('all')
624
+ ## @option opt [Boolean] :unfinished (false)
625
+ ## @option opt [Array or String] :tag ([]) Array or comma-separated string
626
+ ## @option opt [Symbol] :tag_bool (:and) :and, :or, :not
627
+ ## @option opt [String] :search ('') string, optional regex with `/string/`
628
+ ## @option opt [Array] :date_filter (nil) [[Time]start, [Time]end]
629
+ ## @option opt [Boolean] :only_timed (false)
630
+ ## @option opt [String] :before (nil) Date/Time string, unparsed
631
+ ## @option opt [String] :after (nil) Date/Time string, unparsed
632
+ ## @option opt [Boolean] :today (false) limit to entries from today
633
+ ## @option opt [Boolean] :yesterday (false) limit to entries from yesterday
634
+ ## @option opt [Number] :count (0) max entries to return
635
+ ## @option opt [String] :age (new) 'old' or 'new'
636
636
  ##
637
637
  def filter_items(items = Items.new, opt: {})
638
638
  time_rx = /^(\d{1,2}+(:\d{1,2}+)?( *(am|pm))?|midnight|noon)$/
@@ -789,7 +789,7 @@ module Doing
789
789
 
790
790
  output = Items.new
791
791
 
792
- if opt[:age] =~ /^o/i
792
+ if opt[:age] && opt[:age].normalize_age == :oldest
793
793
  output.concat(filtered_items.slice(0, count).reverse)
794
794
  else
795
795
  output.concat(filtered_items.reverse.slice(0, count))
@@ -1519,7 +1519,8 @@ module Doing
1519
1519
  opt[:duration] ||= cfg['duration'] || false
1520
1520
  opt[:interval_format] ||= cfg['interval_format'] || 'text'
1521
1521
  opt[:count] ||= 0
1522
- opt[:age] ||= 'newest'
1522
+ opt[:age] ||= :newest
1523
+ opt[:age] = opt[:age].normalize_age
1523
1524
  opt[:format] ||= cfg['date_format']
1524
1525
  opt[:order] ||= cfg['order'] || 'asc'
1525
1526
  opt[:tag_order] ||= 'asc'
@@ -30,7 +30,7 @@ class BashCompletions
30
30
  need_export = []
31
31
 
32
32
  @commands.each_with_index do |cmd, i|
33
- @bar.advance
33
+ @bar.advance(status: cmd[:commands].first)
34
34
 
35
35
  data = get_help_sections(cmd[:commands].first)
36
36
 
@@ -188,7 +188,7 @@ class BashCompletions
188
188
  data = get_help_sections
189
189
  @global_options = parse_options(data[:global_options])
190
190
  @commands = parse_commands(data[:commands])
191
- @bar = TTY::ProgressBar.new("\033[0;0;33mGenerating Bash completions: \033[0;35;40m[:bar]\033[0m", total: @commands.count, bar_format: :blade)
191
+ @bar = TTY::ProgressBar.new("\033[0;0;33mGenerating Bash completions: \033[0;35;40m[:bar] :status\033[0m", total: @commands.count, bar_format: :blade, status: '')
192
192
  @bar.resize(25)
193
193
  end
194
194
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doing
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.9
4
+ version: 2.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra