doing 2.1.16 → 2.1.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.yardoc/checksums +8 -8
  3. data/.yardoc/object_types +0 -0
  4. data/.yardoc/objects/root.dat +0 -0
  5. data/CHANGELOG.md +20 -0
  6. data/Gemfile.lock +1 -1
  7. data/README.md +1 -1
  8. data/bin/doing +23 -2
  9. data/docs/doc/Array.html +1 -1
  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 +6 -2
  17. data/docs/doc/Doing/Completion.html +1 -1
  18. data/docs/doc/Doing/Configuration.html +4 -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 +119 -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/Util/Backup.html +1 -1
  39. data/docs/doc/Doing/Util.html +1 -1
  40. data/docs/doc/Doing/WWID.html +1 -1
  41. data/docs/doc/Doing.html +2 -2
  42. data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
  43. data/docs/doc/GLI/Commands.html +1 -1
  44. data/docs/doc/GLI.html +1 -1
  45. data/docs/doc/Hash.html +1 -1
  46. data/docs/doc/Numeric.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 +137 -1
  56. data/docs/doc/Symbol.html +1 -1
  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 +158 -110
  62. data/docs/doc/top-level-namespace.html +1 -1
  63. data/doing.rdoc +21 -1
  64. data/lib/completion/_doing.zsh +5 -5
  65. data/lib/completion/doing.bash +8 -8
  66. data/lib/completion/doing.fish +4 -0
  67. data/lib/doing/colors.rb +4 -0
  68. data/lib/doing/configuration.rb +2 -1
  69. data/lib/doing/item.rb +51 -0
  70. data/lib/doing/log_adapter.rb +2 -2
  71. data/lib/doing/plugins/export/template_export.rb +2 -0
  72. data/lib/doing/prompt.rb +16 -5
  73. data/lib/doing/string.rb +40 -0
  74. data/lib/doing/version.rb +1 -1
  75. data/lib/doing/wwid.rb +9 -8
  76. metadata +1 -1
@@ -102,7 +102,7 @@
102
102
  </div>
103
103
 
104
104
  <div id="footer">
105
- Generated on Tue Jan 18 02:48:57 2022 by
105
+ Generated on Tue Jan 18 07:38:21 2022 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/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.16
8
+ v2.1.17
9
9
 
10
10
  === Global Options
11
11
  === --config_file arg
@@ -812,6 +812,11 @@ Edit matching entries with vim
812
812
 
813
813
 
814
814
 
815
+ ===== -h|--[no-]hilite
816
+ Highlight search matches in output. Only affects command line output
817
+
818
+
819
+
815
820
  ===== -i|--interactive
816
821
  Display an interactive menu of results to perform further operations
817
822
 
@@ -1014,6 +1019,11 @@ Edit entry with vim
1014
1019
 
1015
1020
 
1016
1021
 
1022
+ ===== -h|--[no-]hilite
1023
+ Highlight search matches in output. Only affects command line output
1024
+
1025
+
1026
+
1017
1027
  ===== --not
1018
1028
  Show items that *don't* match search string or tag filter
1019
1029
 
@@ -1908,6 +1918,11 @@ Show elapsed time on entries without @done tag
1908
1918
 
1909
1919
 
1910
1920
 
1921
+ ===== -h|--[no-]hilite
1922
+ Highlight search matches in output. Only affects command line output
1923
+
1924
+
1925
+
1911
1926
  ===== -i|--interactive
1912
1927
  Select from a menu of matching entries to perform additional operations
1913
1928
 
@@ -2468,6 +2483,11 @@ Show elapsed time on entries without @done tag
2468
2483
 
2469
2484
 
2470
2485
 
2486
+ ===== -h|--[no-]hilite
2487
+ Highlight search matches in output. Only affects command line output
2488
+
2489
+
2490
+
2471
2491
  ===== -i|--interactive
2472
2492
  Select from a menu of matching entries to perform additional operations
2473
2493
 
@@ -115,10 +115,10 @@ function _doing() {
115
115
  args=( {-a,--archive}"[Archive entries]" "(--at=)--at=}[Set finish date to specific date/time]" "(--auto)--auto}[Auto-generate finish dates from next entrys start times start time]" {-b,--back=}"[Backdate completed date to date string [4pm|20m|2h|yesterday noon]]" "(--bool=)--bool=}[Boolean]" "(--case=)--case=}[Case sensitivity for search string matching [(c)ase-sensitive]" "(--date)--date}[Include date]" {-i,--interactive}"[Select item(s) to finish from a menu of matching entries]" "(--not)--not}[Finish items that *dont* match search/tag filterst* match search/tag filters]" {-r,--remove}"[Remove done tag]" {-s,--section=}"[Section]" "(--search=)--search=}[Finish the last X entries matching search filter]" "(--for=)--for=}[Set the completed date to the start date plus XX[hmd]]" "(--tag=)--tag=}[Finish the last X entries containing TAG]" {-u,--unfinished}"[Finish last entry]" "(--val=)--val=}[Perform a tag value query]" {-x,--exact}"[Force exact search string matching]" )
116
116
  ;;
117
117
  grep)
118
- args=( "(--after=)--after=}[Search entries newer than date]" "(--before=)--before=}[Search entries older than date]" "(--bool=)--bool=}[Combine multiple tags or value queries using AND]" "(--case=)--case=}[Case sensitivity for search string matching [(c)ase-sensitive]" {-d,--delete}"[Delete matching entries]" "(--duration)--duration}[Show elapsed time on entries without @done tag]" {-e,--editor}"[Edit matching entries with vim]" "(--from=)--from=}[Date range to show]" {-i,--interactive}"[Display an interactive menu of results to perform further 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]" {-t,--times}"[Show time intervals on @done tasks]" "(--tag_sort=)--tag_sort=}[Sort tags by]" "(--totals)--totals}[Show intervals with totals at the end of output]" "(--val=)--val=}[Perform a tag value query]" {-x,--exact}"[Force exact string matching]" )
118
+ args=( "(--after=)--after=}[Search entries newer than date]" "(--before=)--before=}[Search entries older than date]" "(--bool=)--bool=}[Combine multiple tags or value queries using AND]" "(--case=)--case=}[Case sensitivity for search string matching [(c)ase-sensitive]" {-d,--delete}"[Delete matching entries]" "(--duration)--duration}[Show elapsed time on entries without @done tag]" {-e,--editor}"[Edit matching entries with vim]" "(--from=)--from=}[Date range to show]" {-h,--hilite}"[Highlight search matches in output]" {-i,--interactive}"[Display an interactive menu of results to perform further 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]" {-t,--times}"[Show time intervals on @done tasks]" "(--tag_sort=)--tag_sort=}[Sort tags by]" "(--totals)--totals}[Show intervals with totals at the end of output]" "(--val=)--val=}[Perform a tag value query]" {-x,--exact}"[Force exact string matching]" )
119
119
  ;;
120
120
  search)
121
- args=( "(--after=)--after=}[Search entries newer than date]" "(--before=)--before=}[Search entries older than date]" "(--bool=)--bool=}[Combine multiple tags or value queries using AND]" "(--case=)--case=}[Case sensitivity for search string matching [(c)ase-sensitive]" {-d,--delete}"[Delete matching entries]" "(--duration)--duration}[Show elapsed time on entries without @done tag]" {-e,--editor}"[Edit matching entries with vim]" "(--from=)--from=}[Date range to show]" {-i,--interactive}"[Display an interactive menu of results to perform further 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]" {-t,--times}"[Show time intervals on @done tasks]" "(--tag_sort=)--tag_sort=}[Sort tags by]" "(--totals)--totals}[Show intervals with totals at the end of output]" "(--val=)--val=}[Perform a tag value query]" {-x,--exact}"[Force exact string matching]" )
121
+ args=( "(--after=)--after=}[Search entries newer than date]" "(--before=)--before=}[Search entries older than date]" "(--bool=)--bool=}[Combine multiple tags or value queries using AND]" "(--case=)--case=}[Case sensitivity for search string matching [(c)ase-sensitive]" {-d,--delete}"[Delete matching entries]" "(--duration)--duration}[Show elapsed time on entries without @done tag]" {-e,--editor}"[Edit matching entries with vim]" "(--from=)--from=}[Date range to show]" {-h,--hilite}"[Highlight search matches in output]" {-i,--interactive}"[Display an interactive menu of results to perform further 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]" {-t,--times}"[Show time intervals on @done tasks]" "(--tag_sort=)--tag_sort=}[Sort tags by]" "(--totals)--totals}[Show intervals with totals at the end of output]" "(--val=)--val=}[Perform a tag value query]" {-x,--exact}"[Force exact string matching]" )
122
122
  ;;
123
123
  help)
124
124
  args=( )
@@ -127,7 +127,7 @@ function _doing() {
127
127
  args=( "(--after=)--after=}[Import entries newer than date]" "(--autotag)--autotag}[Autotag entries]" "(--before=)--before=}[Import entries older than date]" "(--case=)--case=}[Case sensitivity for search string matching [(c)ase-sensitive]" {-f,--from=}"[Date range to import]" "(--not)--not}[Import items that *dont* match search/tag/date filterst* match search/tag/date filters]" "(--only_timed)--only_timed}[Only import items with recorded time intervals]" "(--overlap)--overlap}[Allow entries that overlap existing times]" "(--prefix=)--prefix=}[Prefix entries with]" {-s,--section=}"[Target section]" "(--search=)--search=}[Only import items matching search]" {-t,--tag=}"[Tag all imported entries]" "(--type=)--type=}[Import type]" {-x,--exact}"[Force exact search string matching]" )
128
128
  ;;
129
129
  last)
130
- args=( "(--bool=)--bool=}[Tag boolean]" "(--case=)--case=}[Case sensitivity for search string matching [(c)ase-sensitive]" {-d,--delete}"[Delete the last entry]" "(--duration)--duration}[Show elapsed time if entry is not tagged @done]" {-e,--editor}"[Edit entry with vim]" "(--not)--not}[Show items that *dont* match search string or tag filtert* match search string or tag filter]" {-s,--section=}"[Specify a section]" "(--search=)--search=}[Search filter]" "(--tag=)--tag=}[Tag filter]" "(--val=)--val=}[Perform a tag value query]" {-x,--exact}"[Force exact search string matching]" )
130
+ args=( "(--bool=)--bool=}[Tag boolean]" "(--case=)--case=}[Case sensitivity for search string matching [(c)ase-sensitive]" {-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 string or tag filtert* match search string or tag filter]" {-s,--section=}"[Specify a section]" "(--search=)--search=}[Search filter]" "(--tag=)--tag=}[Tag filter]" "(--val=)--val=}[Perform a tag value query]" {-x,--exact}"[Force exact search string matching]" )
131
131
  ;;
132
132
  later)
133
133
  args=( "(--ask)--ask}[Prompt for note via multi-line input]" {-b,--back=}"[Backdate start time to date string [4pm|20m|2h|yesterday noon]]" {-e,--editor}"[Edit entry with vim]" {-n,--note=}"[Note]" )
@@ -178,7 +178,7 @@ function _doing() {
178
178
  args=( {-a,--archive}"[Archive selected items]" "(--after=)--after=}[Select from entries newer than date]" "(--resume)--resume}[Copy selection as a new entry with current time and no @done tag]" "(--before=)--before=}[Select from entries older than date]" {-c,--cancel}"[Cancel selected items]" "(--case=)--case=}[Case sensitivity for search string matching [(c)ase-sensitive]" {-d,--delete}"[Delete selected items]" {-e,--editor}"[Edit selected item(s)]" {-f,--finish}"[Add @done with current time to selected item(s)]" "(--flag)--flag}[Add flag to selected item(s)]" "(--force)--force}[Perform action without confirmation]" "(--from=)--from=}[Date range to show]" {-m,--move=}"[Move selected items to section]" "(--menu)--menu}[Use --no-menu to skip the interactive menu]" "(--not)--not}[Select items that *dont* match search/tag filterst* match search/tag filters]" {-o,--output=}"[Output entries to format]" {-q,--query=}"[Initial search query for filtering]" {-r,--remove}"[Reverse -c]" {-s,--section=}"[Select from a specific section]" "(--save_to=)--save_to=}[Save selected entries to file using --output format]" "(--search=)--search=}[Select from entries matching search filter]" {-t,--tag=}"[Tag selected entries]" "(--val=)--val=}[Perform a tag value query]" {-x,--exact}"[Force exact search string matching]" )
179
179
  ;;
180
180
  show)
181
- args=( {-a,--age=}"[Age]" "(--after=)--after=}[Show entries newer than date]" {-b,--bool=}"[Tag boolean]" "(--before=)--before=}[Show entries older than date]" {-c,--count=}"[Max count to show]" "(--case=)--case=}[Case sensitivity for search string matching [(c)ase-sensitive]" "(--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]" {-m,--menu}"[Select section or tag to display from a menu]" "(--not)--not}[Show items that *dont* match search/tag/date filterst* match search/tag/date filters]" {-o,--output=}"[Output to export format]" "(--only_timed)--only_timed}[Only show items with recorded time intervals]" {-s,--sort=}"[Sort order]" "(--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]" "(--val=)--val=}[Perform a tag value query]" {-x,--exact}"[Force exact search string matching]" )
181
+ args=( {-a,--age=}"[Age]" "(--after=)--after=}[Show entries newer than date]" {-b,--bool=}"[Tag boolean]" "(--before=)--before=}[Show entries older than date]" {-c,--count=}"[Max count to show]" "(--case=)--case=}[Case sensitivity for search string matching [(c)ase-sensitive]" "(--duration)--duration}[Show elapsed time on entries without @done tag]" "(--from=)--from=}[Date range to show]" {-h,--hilite}"[Highlight search matches in output]" {-i,--interactive}"[Select from a menu of matching entries to perform additional operations]" {-m,--menu}"[Select section or tag to display from a menu]" "(--not)--not}[Show items that *dont* match search/tag/date filterst* match search/tag/date filters]" {-o,--output=}"[Output to export format]" "(--only_timed)--only_timed}[Only show items with recorded time intervals]" {-s,--sort=}"[Sort order]" "(--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]" "(--val=)--val=}[Perform a tag value query]" {-x,--exact}"[Force exact search string matching]" )
182
182
  ;;
183
183
  since)
184
184
  args=( "(--duration)--duration}[Show elapsed time on entries without @done tag]" {-o,--output=}"[Output to export format]" {-s,--section=}"[Section]" {-t,--times}"[Show time intervals on @done tasks]" "(--tag_sort=)--tag_sort=}[Sort tags by]" "(--totals)--totals}[Show time totals at the end of output]" )
@@ -205,7 +205,7 @@ function _doing() {
205
205
  args=( {-f,--file=}"[Specify alternate doing file]" {-i,--interactive}"[Select from recent backups]" {-p,--prune=}"[Remove old backups]" {-r,--redo}"[Redo last undo]" )
206
206
  ;;
207
207
  view)
208
- 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]" "(--val=)--val=}[Perform a tag value query]" {-x,--exact}"[Force exact search string matching]" )
208
+ 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]" {-h,--hilite}"[Highlight search matches in output]" {-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]" "(--val=)--val=}[Perform a tag value query]" {-x,--exact}"[Force exact search string matching]" )
209
209
  ;;
210
210
  views)
211
211
  args=( {-c,--column}"[List in single column]" )
@@ -101,9 +101,9 @@ _doing_finish() {
101
101
  _doing_grep() {
102
102
 
103
103
  if [[ "$token" == --* ]]; then
104
- COMPREPLY=( $( compgen -W '--after --before --bool --case --delete --duration --editor --from --interactive --not --output --only_timed --section --times --tag_sort --totals --val --exact' -- $token ) )
104
+ COMPREPLY=( $( compgen -W '--after --before --bool --case --delete --duration --editor --from --hilite --interactive --not --output --only_timed --section --times --tag_sort --totals --val --exact' -- $token ) )
105
105
  elif [[ "$token" == -* ]]; then
106
- COMPREPLY=( $( compgen -W '-d -e -i -o -s -t -x --after --before --bool --case --delete --duration --editor --from --interactive --not --output --only_timed --section --times --tag_sort --totals --val --exact' -- $token ) )
106
+ COMPREPLY=( $( compgen -W '-d -e -h -i -o -s -t -x --after --before --bool --case --delete --duration --editor --from --hilite --interactive --not --output --only_timed --section --times --tag_sort --totals --val --exact' -- $token ) )
107
107
 
108
108
  fi
109
109
  }
@@ -131,9 +131,9 @@ _doing_import() {
131
131
  _doing_last() {
132
132
 
133
133
  if [[ "$token" == --* ]]; then
134
- COMPREPLY=( $( compgen -W '--bool --case --delete --duration --editor --not --section --search --tag --val --exact' -- $token ) )
134
+ COMPREPLY=( $( compgen -W '--bool --case --delete --duration --editor --hilite --not --section --search --tag --val --exact' -- $token ) )
135
135
  elif [[ "$token" == -* ]]; then
136
- COMPREPLY=( $( compgen -W '-d -e -s -x --bool --case --delete --duration --editor --not --section --search --tag --val --exact' -- $token ) )
136
+ COMPREPLY=( $( compgen -W '-d -e -h -s -x --bool --case --delete --duration --editor --hilite --not --section --search --tag --val --exact' -- $token ) )
137
137
 
138
138
  fi
139
139
  }
@@ -276,9 +276,9 @@ local words=$(doing sections)
276
276
  IFS="$OLD_IFS"
277
277
 
278
278
  if [[ "$token" == --* ]]; then
279
- COMPREPLY=( $( compgen -W '--age --after --bool --before --count --case --duration --from --interactive --menu --not --output --only_timed --sort --search --times --tag --tag_order --tag_sort --totals --val --exact' -- $token ) )
279
+ COMPREPLY=( $( compgen -W '--age --after --bool --before --count --case --duration --from --hilite --interactive --menu --not --output --only_timed --sort --search --times --tag --tag_order --tag_sort --totals --val --exact' -- $token ) )
280
280
  elif [[ "$token" == -* ]]; then
281
- COMPREPLY=( $( compgen -W '-a -b -c -i -m -o -s -t -x --age --after --bool --before --count --case --duration --from --interactive --menu --not --output --only_timed --sort --search --times --tag --tag_order --tag_sort --totals --val --exact' -- $token ) )
281
+ COMPREPLY=( $( compgen -W '-a -b -c -h -i -m -o -s -t -x --age --after --bool --before --count --case --duration --from --hilite --interactive --menu --not --output --only_timed --sort --search --times --tag --tag_order --tag_sort --totals --val --exact' -- $token ) )
282
282
  else
283
283
  local nocasematchWasOff=0
284
284
  shopt nocasematch >/dev/null || nocasematchWasOff=1
@@ -376,9 +376,9 @@ local words=$(doing views)
376
376
  IFS="$OLD_IFS"
377
377
 
378
378
  if [[ "$token" == --* ]]; then
379
- 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 --val --exact' -- $token ) )
379
+ COMPREPLY=( $( compgen -W '--after --age --bool --before --count --case --color --duration --from --hilite --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --totals --val --exact' -- $token ) )
380
380
  elif [[ "$token" == -* ]]; then
381
- 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 --val --exact' -- $token ) )
381
+ COMPREPLY=( $( compgen -W '-b -c -h -i -o -s -t -x --after --age --bool --before --count --case --color --duration --from --hilite --interactive --not --output --only_timed --section --search --times --tag --tag_order --tag_sort --totals --val --exact' -- $token ) )
382
382
  else
383
383
  local nocasematchWasOff=0
384
384
  shopt nocasematch >/dev/null || nocasematchWasOff=1
@@ -183,6 +183,7 @@ complete -c doing -l delete -s d -f -n '__fish_doing_using_command grep search'
183
183
  complete -c doing -l duration -f -n '__fish_doing_using_command grep search' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
184
184
  complete -c doing -l editor -s e -f -n '__fish_doing_using_command grep search' -d Edit\ matching\ entries\ with\ vim
185
185
  complete -c doing -l from -f -r -n '__fish_doing_using_command grep search' -d Date\ range\ to\ show
186
+ complete -c doing -l hilite -s h -f -n '__fish_doing_using_command grep search' -d Highlight\ search\ matches\ in\ output
186
187
  complete -c doing -l interactive -s i -f -n '__fish_doing_using_command grep search' -d Display\ an\ interactive\ menu\ of\ results\ to\ perform\ further\ operations
187
188
  complete -c doing -l not -f -n '__fish_doing_using_command grep search' -d Show\ items\ that\ \*don\'t\*\ match\ search\ string
188
189
  complete -c doing -l output -s o -f -r -n '__fish_doing_using_command grep search' -d Output\ to\ export\ format
@@ -213,6 +214,7 @@ complete -c doing -l case -f -r -n '__fish_doing_using_command last' -d Case\ s
213
214
  complete -c doing -l delete -s d -f -n '__fish_doing_using_command last' -d Delete\ the\ last\ entry
214
215
  complete -c doing -l duration -f -n '__fish_doing_using_command last' -d Show\ elapsed\ time\ if\ entry\ is\ not\ tagged\ @done
215
216
  complete -c doing -l editor -s e -f -n '__fish_doing_using_command last' -d Edit\ entry\ with\ vim
217
+ complete -c doing -l hilite -s h -f -n '__fish_doing_using_command last' -d Highlight\ search\ matches\ in\ output
216
218
  complete -c doing -l not -f -n '__fish_doing_using_command last' -d Show\ items\ that\ \*don\'t\*\ match\ search\ string\ or\ tag\ filter
217
219
  complete -c doing -l section -s s -f -r -n '__fish_doing_using_command last' -d Specify\ a\ section
218
220
  complete -c doing -l search -f -r -n '__fish_doing_using_command last' -d Search\ filter
@@ -331,6 +333,7 @@ complete -c doing -l count -s c -f -r -n '__fish_doing_using_command show' -d Ma
331
333
  complete -c doing -l case -f -r -n '__fish_doing_using_command show' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
332
334
  complete -c doing -l duration -f -n '__fish_doing_using_command show' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
333
335
  complete -c doing -l from -f -r -n '__fish_doing_using_command show' -d Date\ range\ to\ show
336
+ complete -c doing -l hilite -s h -f -n '__fish_doing_using_command show' -d Highlight\ search\ matches\ in\ output
334
337
  complete -c doing -l interactive -s i -f -n '__fish_doing_using_command show' -d Select\ from\ a\ menu\ of\ matching\ entries\ to\ perform\ additional\ operations
335
338
  complete -c doing -l menu -s m -f -n '__fish_doing_using_command show' -d Select\ section\ or\ tag\ to\ display\ from\ a\ menu
336
339
  complete -c doing -l not -f -n '__fish_doing_using_command show' -d Show\ items\ that\ \*don\'t\*\ match\ search/tag/date\ filters
@@ -408,6 +411,7 @@ complete -c doing -l case -f -r -n '__fish_doing_using_command view' -d Case\ s
408
411
  complete -c doing -l color -f -n '__fish_doing_using_command view' -d Include\ colors\ in\ output
409
412
  complete -c doing -l duration -f -n '__fish_doing_using_command view' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
410
413
  complete -c doing -l from -f -r -n '__fish_doing_using_command view' -d Date\ range\ to\ show
414
+ complete -c doing -l hilite -s h -f -n '__fish_doing_using_command view' -d Highlight\ search\ matches\ in\ output
411
415
  complete -c doing -l interactive -s i -f -n '__fish_doing_using_command view' -d Select\ from\ a\ menu\ of\ matching\ entries\ to\ perform\ additional\ operations
412
416
  complete -c doing -l not -f -n '__fish_doing_using_command view' -d Show\ items\ that\ \*don\'t\*\ match\ search\ string
413
417
  complete -c doing -l output -s o -f -r -n '__fish_doing_using_command view' -d Output\ to\ export\ format
data/lib/doing/colors.rb CHANGED
@@ -24,6 +24,7 @@ module Doing
24
24
  [:yellow, 33],
25
25
  [:blue, 34],
26
26
  [:magenta, 35],
27
+ [:purple, 35],
27
28
  [:cyan, 36],
28
29
  [:white, 37],
29
30
  [:bgblack, 40],
@@ -32,6 +33,7 @@ module Doing
32
33
  [:bgyellow, 43],
33
34
  [:bgblue, 44],
34
35
  [:bgmagenta, 45],
36
+ [:bgpurple, 45],
35
37
  [:bgcyan, 46],
36
38
  [:bgwhite, 47],
37
39
  [:boldblack, 90], # High intensity, aixterm (works in OS X)
@@ -40,6 +42,7 @@ module Doing
40
42
  [:boldyellow, 93],
41
43
  [:boldblue, 94],
42
44
  [:boldmagenta, 95],
45
+ [:boldpurple, 95],
43
46
  [:boldcyan, 96],
44
47
  [:boldwhite, 97],
45
48
  [:boldbgblack, 100], # High intensity background, aixterm (works in OS X)
@@ -48,6 +51,7 @@ module Doing
48
51
  [:boldbgyellow, 103],
49
52
  [:boldbgblue, 104],
50
53
  [:boldbgmagenta, 105],
54
+ [:boldbgpurple, 105],
51
55
  [:boldbgcyan, 106],
52
56
  [:boldbgwhite, 107],
53
57
  [:softpurple, '0;35;40'],
@@ -99,7 +99,8 @@ module Doing
99
99
  'search' => {
100
100
  'matching' => 'pattern', # fuzzy, pattern, exact
101
101
  'distance' => 3,
102
- 'case' => 'smart' # sensitive, ignore, smart
102
+ 'case' => 'smart', # sensitive, ignore, smart
103
+ 'highlight' => false
103
104
  },
104
105
  'include_notes' => true,
105
106
  'interaction' => {
data/lib/doing/item.rb CHANGED
@@ -9,6 +9,8 @@ module Doing
9
9
 
10
10
  # attr_reader :id
11
11
 
12
+ include Color
13
+
12
14
  ##
13
15
  ## Initialize an item with date, title, section, and
14
16
  ## optional note
@@ -269,6 +271,34 @@ module Doing
269
271
  (case_type == :smart && search !~ /[A-Z]/) || case_type == :ignore
270
272
  end
271
273
 
274
+ def highlight_search(search, distance: nil, negate: false, case_type: nil)
275
+ prefs = Doing.config.settings['search'] || {}
276
+ matching = prefs.fetch('matching', 'pattern').normalize_matching
277
+ distance ||= prefs.fetch('distance', 3).to_i
278
+ case_type ||= prefs.fetch('case', 'smart').normalize_case
279
+ new_note = Note.new
280
+
281
+ if search.is_rx? || matching == :fuzzy
282
+ rx = search.to_rx(distance: distance, case_type: case_type)
283
+ new_title = @title.gsub(rx) { |m| yellow(m) }
284
+ new_note.add(@note.to_s.gsub(rx) { |m| yellow(m) })
285
+ else
286
+ query = to_phrase_query(search.strip)
287
+
288
+ if query[:must].nil? && query[:must_not].nil?
289
+ query[:must] = query[:should]
290
+ query[:should] = []
291
+ end
292
+ query[:must].concat(query[:should]).each do |s|
293
+ rx = Regexp.new(s.wildcard_to_rx, ignore_case(s, case_type))
294
+ new_title = @title.gsub(rx) { |m| yellow(m) }
295
+ new_note.add(@note.to_s.gsub(rx) { |m| yellow(m) })
296
+ end
297
+ end
298
+
299
+ Item.new(@date, new_title, @section, new_note)
300
+ end
301
+
272
302
  ##
273
303
  ## Test if item matches search string
274
304
  ##
@@ -372,6 +402,27 @@ module Doing
372
402
  "\t- #{@date.strftime('%Y-%m-%d %H:%M')} | #{@title}#{@note.empty? ? '' : "\n#{@note}"}"
373
403
  end
374
404
 
405
+ ##
406
+ ## outputs a colored string with relative date and highlighted tags
407
+ ##
408
+ ## @return Pretty representation of the object.
409
+ ##
410
+ def to_pretty(elements: %i[date title section])
411
+ output = []
412
+ elements.each do |e|
413
+ case e
414
+ when :date
415
+ output << format('%13s |', @date.relative_date).cyan
416
+ when :section
417
+ output << "#{magenta}(#{white(@section)}#{magenta})"
418
+ when :title
419
+ output << @title.white.highlight_tags('cyan')
420
+ end
421
+ end
422
+
423
+ output.join(' ')
424
+ end
425
+
375
426
  # @private
376
427
  def inspect
377
428
  # %(<Doing::Item @date=#{@date} @title="#{@title}" @section:"#{@section}" @note:#{@note.to_s}>)
@@ -398,9 +398,9 @@ module Doing
398
398
  return topic.ljust(TOPIC_WIDTH) if topic && message.strip.empty?
399
399
 
400
400
  topic = formatted_topic(topic, colon: block_given?)
401
- message.truncmiddle!(@max_length - TOPIC_WIDTH - 5)
401
+ # message.truncmiddle!(@max_length - TOPIC_WIDTH - 5)
402
402
  out = topic + message
403
- out.truncate!(@max_length) if @max_length.positive?
403
+ # out.truncate!(@max_length) if @max_length.positive?
404
404
  messages << out
405
405
  out
406
406
  end
@@ -119,6 +119,8 @@ module Doing
119
119
 
120
120
  output.gsub!(/\\%/, '%')
121
121
 
122
+ output.highlight_search!(opt[:search]) if opt[:search] && !opt[:not] && opt[:hilite]
123
+
122
124
  out += "#{output}\n"
123
125
  end
124
126
 
data/lib/doing/prompt.rb CHANGED
@@ -17,6 +17,7 @@ module Doing
17
17
  end
18
18
 
19
19
  def enter_text(prompt, default_response: '')
20
+ $stdin.reopen('/dev/tty')
20
21
  return default_response if @default_answer
21
22
 
22
23
  print "#{yellow(prompt).sub(/:?$/, ':')} #{reset}"
@@ -24,12 +25,13 @@ module Doing
24
25
  end
25
26
 
26
27
  def read_line(prompt: 'Enter text', completions: [], default_response: '')
28
+ $stdin.reopen('/dev/tty')
27
29
  return default_response if @default_answer
28
30
 
29
31
  unless completions.empty?
30
32
  completions.sort!
31
33
  comp = proc { |s| completions.grep(/^#{Regexp.escape(s)}/) }
32
- Readline.completion_append_character = " "
34
+ Readline.completion_append_character = ' '
33
35
  Readline.completion_proc = comp
34
36
  end
35
37
 
@@ -41,20 +43,26 @@ module Doing
41
43
  end
42
44
 
43
45
  def read_lines(prompt: 'Enter text', completions: [])
46
+ $stdin.reopen('/dev/tty')
44
47
  return default_response if @default_answer
45
48
 
46
49
  completions.sort!
47
50
  comp = proc { |s| completions.grep(/^#{Regexp.escape(s)}/) }
48
- Readline.completion_append_character = " "
51
+ Readline.completion_append_character = ' '
49
52
  Readline.completion_proc = comp
50
-
51
- puts "#{boldgreen(prompt.sub(/:?$/, ':'))} #{yellow('Hit return for a new line, ')}#{boldwhite('enter a blank line (')}#{boldyellow('return twice')}#{boldwhite(') to end editing')}"
53
+ prompt_text = []
54
+ prompt_text << boldgreen(prompt.sub(/:?$/, ':'))
55
+ prompt_text << yellow(' Enter a blank line (')
56
+ prompt_text << boldwhite('return twice')
57
+ prompt_text << yellow(') to end editing')
58
+ puts prompt_text.join('')
52
59
 
53
60
  res = []
54
61
 
55
62
  begin
56
- while line = Readline.readline('> ', true)
63
+ while (line = Readline.readline('> ', true))
57
64
  break if line.strip.empty?
65
+
58
66
  res << line.chomp
59
67
  end
60
68
  rescue Interrupt
@@ -65,6 +73,7 @@ module Doing
65
73
  end
66
74
 
67
75
  def request_lines(prompt: 'Enter text')
76
+ $stdin.reopen('/dev/tty')
68
77
  ask_note = []
69
78
  reader = TTY::Reader.new(interrupt: -> { raise Errors::UserCancelled }, track_history: false)
70
79
  puts "#{boldgreen(prompt.sub(/:?$/, ':'))} #{yellow('Hit return for a new line, ')}#{boldwhite('enter a blank line (')}#{boldyellow('return twice')}#{boldwhite(') to end editing')}"
@@ -92,6 +101,8 @@ module Doing
92
101
  return @force_answer
93
102
  end
94
103
 
104
+ $stdin.reopen('/dev/tty')
105
+
95
106
  default = if default_response.is_a?(String)
96
107
  default_response =~ /y/i ? true : false
97
108
  else
data/lib/doing/string.rb CHANGED
@@ -101,6 +101,46 @@ module Doing
101
101
  gsub(/(\s|m)(@[^ ("']+)/, "\\1#{tag_color}\\2#{last_color}")
102
102
  end
103
103
 
104
+ def to_phrase_query(query)
105
+ parser = PhraseParser::QueryParser.new
106
+ transformer = PhraseParser::QueryTransformer.new
107
+ parse_tree = parser.parse(query)
108
+ transformer.apply(parse_tree).to_elasticsearch
109
+ end
110
+
111
+ def ignore_case(search, case_type)
112
+ (case_type == :smart && search !~ /[A-Z]/) || case_type == :ignore
113
+ end
114
+
115
+ def highlight_search!(search, distance: nil, negate: false, case_type: nil)
116
+ replace highlight_search(search, distance: distance, negate: negate, case_type: case_type)
117
+ end
118
+
119
+ def highlight_search(search, distance: nil, negate: false, case_type: nil)
120
+ out = dup
121
+ prefs = Doing.config.settings['search'] || {}
122
+ matching = prefs.fetch('matching', 'pattern').normalize_matching
123
+ distance ||= prefs.fetch('distance', 3).to_i
124
+ case_type ||= prefs.fetch('case', 'smart').normalize_case
125
+
126
+ if search.is_rx? || matching == :fuzzy
127
+ rx = search.to_rx(distance: distance, case_type: case_type)
128
+ out.gsub!(rx) { |m| m.bgyellow.black }
129
+ else
130
+ query = to_phrase_query(search.strip)
131
+
132
+ if query[:must].nil? && query[:must_not].nil?
133
+ query[:must] = query[:should]
134
+ query[:should] = []
135
+ end
136
+ query[:must].concat(query[:should]).each do |s|
137
+ rx = Regexp.new(s.wildcard_to_rx, ignore_case(s, case_type))
138
+ out.gsub!(rx) { |m| m.bgyellow.black }
139
+ end
140
+ end
141
+ out
142
+ end
143
+
104
144
  ##
105
145
  ## Test if line should be ignored
106
146
  ##
data/lib/doing/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Doing
2
- VERSION = '2.1.16'
2
+ VERSION = '2.1.17'
3
3
  end
data/lib/doing/wwid.rb CHANGED
@@ -798,14 +798,14 @@ module Doing
798
798
  end
799
799
 
800
800
  def delete_items(items, force: false)
801
- res = force ? true : Prompt.yn("Delete #{items.size} #{items.size == 1 ? 'item' : 'items'}?", default_response: 'y')
802
- if res
803
- items.each do |i|
804
- deleted = @content.delete_item(i, single: items.count == 1)
805
- Hooks.trigger :post_entry_removed, self, deleted
806
- end
807
- write(@doing_file)
808
- end
801
+ items.slice(0, 5).each { |i| puts i.to_pretty } unless force
802
+ puts softpurple("+ #{items.size - 5} additional #{'item'.to_p(items.size - 5)}") if items.size > 5 && !force
803
+
804
+ res = force ? true : Prompt.yn("Delete #{items.size} #{'item'.to_p(items.size)}?", default_response: 'y')
805
+ return unless res
806
+
807
+ items.each { |i| Hooks.trigger :post_entry_removed, self, @content.delete_item(i, single: items.count == 1) }
808
+ write(@doing_file)
809
809
  end
810
810
 
811
811
  def edit_items(items)
@@ -1650,6 +1650,7 @@ module Doing
1650
1650
 
1651
1651
  opt[:output] ||= 'template'
1652
1652
  opt[:wrap_width] ||= @config['templates']['default']['wrap_width'] || 0
1653
+
1653
1654
  output(items, title, is_single, opt)
1654
1655
  end
1655
1656
 
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.16
4
+ version: 2.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra