doing 2.1.15 → 2.1.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardoc/checksums +10 -10
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/CHANGELOG.md +109 -51
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/bin/doing +131 -45
- data/docs/doc/Array.html +1 -1
- data/docs/doc/BooleanTermParser/Clause.html +1 -1
- data/docs/doc/BooleanTermParser/Operator.html +1 -1
- data/docs/doc/BooleanTermParser/Query.html +1 -1
- data/docs/doc/BooleanTermParser/QueryParser.html +1 -1
- data/docs/doc/BooleanTermParser/QueryTransformer.html +1 -1
- data/docs/doc/BooleanTermParser.html +1 -1
- data/docs/doc/Doing/Color.html +6 -2
- data/docs/doc/Doing/Completion.html +1 -1
- data/docs/doc/Doing/Configuration.html +4 -3
- data/docs/doc/Doing/Errors/DoingNoTraceError.html +1 -1
- data/docs/doc/Doing/Errors/DoingRuntimeError.html +1 -1
- data/docs/doc/Doing/Errors/DoingStandardError.html +1 -1
- data/docs/doc/Doing/Errors/EmptyInput.html +1 -1
- data/docs/doc/Doing/Errors/NoResults.html +1 -1
- data/docs/doc/Doing/Errors/PluginException.html +1 -1
- data/docs/doc/Doing/Errors/UserCancelled.html +1 -1
- data/docs/doc/Doing/Errors/WrongCommand.html +1 -1
- data/docs/doc/Doing/Errors.html +1 -1
- data/docs/doc/Doing/Hooks.html +1 -1
- data/docs/doc/Doing/Item.html +119 -1
- data/docs/doc/Doing/Items.html +1 -1
- data/docs/doc/Doing/LogAdapter.html +1 -1
- data/docs/doc/Doing/Note.html +1 -1
- data/docs/doc/Doing/Pager.html +1 -1
- data/docs/doc/Doing/Plugins.html +1 -1
- data/docs/doc/Doing/Prompt.html +69 -1
- data/docs/doc/Doing/Section.html +1 -1
- data/docs/doc/Doing/TemplateString.html +2 -2
- data/docs/doc/Doing/Util/Backup.html +1 -1
- data/docs/doc/Doing/Util.html +1 -1
- data/docs/doc/Doing/WWID.html +37 -3
- data/docs/doc/Doing.html +2 -2
- data/docs/doc/GLI/Commands/MarkdownDocumentListener.html +1 -1
- data/docs/doc/GLI/Commands.html +1 -1
- data/docs/doc/GLI.html +1 -1
- data/docs/doc/Hash.html +1 -1
- data/docs/doc/Numeric.html +1 -1
- data/docs/doc/PhraseParser/Operator.html +1 -1
- data/docs/doc/PhraseParser/PhraseClause.html +1 -1
- data/docs/doc/PhraseParser/Query.html +1 -1
- data/docs/doc/PhraseParser/QueryParser.html +1 -1
- data/docs/doc/PhraseParser/QueryTransformer.html +1 -1
- data/docs/doc/PhraseParser/TermClause.html +1 -1
- data/docs/doc/PhraseParser.html +1 -1
- data/docs/doc/Status.html +1 -1
- data/docs/doc/String.html +228 -1
- data/docs/doc/Symbol.html +1 -1
- data/docs/doc/Time.html +1 -1
- data/docs/doc/_index.html +1 -1
- data/docs/doc/file.README.html +2 -2
- data/docs/doc/index.html +2 -2
- data/docs/doc/method_list.html +254 -182
- data/docs/doc/top-level-namespace.html +1 -1
- data/doing.rdoc +34 -4
- data/lib/completion/_doing.zsh +7 -7
- data/lib/completion/doing.bash +10 -10
- data/lib/completion/doing.fish +6 -1
- data/lib/doing/colors.rb +4 -0
- data/lib/doing/configuration.rb +2 -1
- data/lib/doing/item.rb +51 -0
- data/lib/doing/log_adapter.rb +2 -2
- data/lib/doing/plugins/export/template_export.rb +2 -0
- data/lib/doing/prompt.rb +52 -0
- data/lib/doing/string.rb +43 -0
- data/lib/doing/string_chronify.rb +28 -0
- data/lib/doing/template_string.rb +1 -1
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +54 -23
- data/lib/doing.rb +5 -4
- metadata +2 -2
@@ -102,7 +102,7 @@
|
|
102
102
|
</div>
|
103
103
|
|
104
104
|
<div id="footer">
|
105
|
-
Generated on
|
105
|
+
Generated on Tue Jan 18 08:53:02 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.
|
8
|
+
v2.1.19
|
9
9
|
|
10
10
|
=== Global Options
|
11
11
|
=== --config_file arg
|
@@ -528,10 +528,10 @@ Use this command to add an entry after you've already finished it. It will be im
|
|
528
528
|
You can modify the start and end times of the entry using the --back, --took, and --at flags, making it an easy
|
529
529
|
way to add entries in post and maintain accurate (albeit manual) time tracking.
|
530
530
|
===== Options
|
531
|
-
===== --at DATE_STRING
|
531
|
+
===== --at|--finished DATE_STRING
|
532
532
|
|
533
533
|
Set finish date to specific date/time (natural langauge parsed, e.g. --at=1:30pm).
|
534
|
-
|
534
|
+
Used with --took, backdates start date
|
535
535
|
|
536
536
|
[Default Value] None
|
537
537
|
|
@@ -543,6 +543,14 @@ Backdate start date by interval or set to time [4pm|20m|2h|"yesterday noon"]
|
|
543
543
|
[Default Value] None
|
544
544
|
|
545
545
|
|
546
|
+
===== --from TIME_RANGE
|
547
|
+
|
548
|
+
Start and end times as a date/time range `doing done --from "1am to 8am"`.
|
549
|
+
Overrides other date flags.
|
550
|
+
|
551
|
+
[Default Value] None
|
552
|
+
|
553
|
+
|
546
554
|
===== -n|--note TEXT
|
547
555
|
|
548
556
|
Include a note
|
@@ -804,6 +812,11 @@ Edit matching entries with vim
|
|
804
812
|
|
805
813
|
|
806
814
|
|
815
|
+
===== -h|--[no-]hilite
|
816
|
+
Highlight search matches in output. Only affects command line output
|
817
|
+
|
818
|
+
|
819
|
+
|
807
820
|
===== -i|--interactive
|
808
821
|
Display an interactive menu of results to perform further operations
|
809
822
|
|
@@ -1006,6 +1019,11 @@ Edit entry with vim
|
|
1006
1019
|
|
1007
1020
|
|
1008
1021
|
|
1022
|
+
===== -h|--[no-]hilite
|
1023
|
+
Highlight search matches in output. Only affects command line output
|
1024
|
+
|
1025
|
+
|
1026
|
+
|
1009
1027
|
===== --not
|
1010
1028
|
Show items that *don't* match search string or tag filter
|
1011
1029
|
|
@@ -1274,7 +1292,9 @@ Record what you're starting now, or backdate the start time using natural langua
|
|
1274
1292
|
|
1275
1293
|
A parenthetical at the end of the entry will be converted to a note.
|
1276
1294
|
|
1277
|
-
Run
|
1295
|
+
Run without arguments to create a new entry interactively.
|
1296
|
+
|
1297
|
+
Run with --editor to create a new entry using vim.
|
1278
1298
|
===== Options
|
1279
1299
|
===== -b|--back|--started DATE_STRING
|
1280
1300
|
|
@@ -1898,6 +1918,11 @@ Show elapsed time on entries without @done tag
|
|
1898
1918
|
|
1899
1919
|
|
1900
1920
|
|
1921
|
+
===== -h|--[no-]hilite
|
1922
|
+
Highlight search matches in output. Only affects command line output
|
1923
|
+
|
1924
|
+
|
1925
|
+
|
1901
1926
|
===== -i|--interactive
|
1902
1927
|
Select from a menu of matching entries to perform additional operations
|
1903
1928
|
|
@@ -2458,6 +2483,11 @@ Show elapsed time on entries without @done tag
|
|
2458
2483
|
|
2459
2484
|
|
2460
2485
|
|
2486
|
+
===== -h|--[no-]hilite
|
2487
|
+
Highlight search matches in output. Only affects command line output
|
2488
|
+
|
2489
|
+
|
2490
|
+
|
2461
2491
|
===== -i|--interactive
|
2462
2492
|
Select from a menu of matching entries to perform additional operations
|
2463
2493
|
|
data/lib/completion/_doing.zsh
CHANGED
@@ -106,19 +106,19 @@ function _doing() {
|
|
106
106
|
args=( {-d,--dump}"[DEPRECATED]" {-u,--update}"[DEPRECATED]" )
|
107
107
|
;;
|
108
108
|
done)
|
109
|
-
args=( {-a,--archive}"[Immediately archive the entry]" "(--ask)--ask}[Prompt for note via multi-line input]" "(--
|
109
|
+
args=( {-a,--archive}"[Immediately archive the entry]" "(--ask)--ask}[Prompt for note via multi-line input]" "(--finished=)--finished=}[Set finish date to specific date/time]" "(--started=)--started=}[Backdate start date by interval or set to time [4pm|20m|2h|"yesterday noon"]]" "(--date)--date}[Include date]" {-e,--editor}"[Edit entry with vim]" "(--from=)--from=}[Start and end times as a date/time range `doing done --from "1am to 8am"`]" {-n,--note=}"[Include a note]" {-r,--remove}"[Remove @done tag]" {-s,--section=}"[Section]" "(--for=)--for=}[Set completion date to start date plus interval]" {-u,--unfinished}"[Finish last entry not already marked @done]" )
|
110
110
|
;;
|
111
111
|
did)
|
112
|
-
args=( {-a,--archive}"[Immediately archive the entry]" "(--ask)--ask}[Prompt for note via multi-line input]" "(--
|
112
|
+
args=( {-a,--archive}"[Immediately archive the entry]" "(--ask)--ask}[Prompt for note via multi-line input]" "(--finished=)--finished=}[Set finish date to specific date/time]" "(--started=)--started=}[Backdate start date by interval or set to time [4pm|20m|2h|"yesterday noon"]]" "(--date)--date}[Include date]" {-e,--editor}"[Edit entry with vim]" "(--from=)--from=}[Start and end times as a date/time range `doing done --from "1am to 8am"`]" {-n,--note=}"[Include a note]" {-r,--remove}"[Remove @done tag]" {-s,--section=}"[Section]" "(--for=)--for=}[Set completion date to start date plus interval]" {-u,--unfinished}"[Finish last entry not already marked @done]" )
|
113
113
|
;;
|
114
114
|
finish)
|
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]" )
|
data/lib/completion/doing.bash
CHANGED
@@ -81,9 +81,9 @@ _doing_config() {
|
|
81
81
|
_doing_done() {
|
82
82
|
|
83
83
|
if [[ "$token" == --* ]]; then
|
84
|
-
COMPREPLY=( $( compgen -W '--archive --ask --
|
84
|
+
COMPREPLY=( $( compgen -W '--archive --ask --finished --started --date --editor --from --note --remove --section --for --unfinished' -- $token ) )
|
85
85
|
elif [[ "$token" == -* ]]; then
|
86
|
-
COMPREPLY=( $( compgen -W '-a -e -n -r -s -u --archive --ask --
|
86
|
+
COMPREPLY=( $( compgen -W '-a -e -n -r -s -u --archive --ask --finished --started --date --editor --from --note --remove --section --for --unfinished' -- $token ) )
|
87
87
|
|
88
88
|
fi
|
89
89
|
}
|
@@ -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
|
data/lib/completion/doing.fish
CHANGED
@@ -148,10 +148,11 @@ complete -c doing -l dump -s d -f -n '__fish_doing_using_command config' -d DEP
|
|
148
148
|
complete -c doing -l update -s u -f -n '__fish_doing_using_command config' -d DEPRECATED
|
149
149
|
complete -c doing -l archive -s a -f -n '__fish_doing_using_command done did' -d Immediately\ archive\ the\ entry
|
150
150
|
complete -c doing -l ask -f -n '__fish_doing_using_command done did' -d Prompt\ for\ note\ via\ multi-line\ input
|
151
|
-
complete -c doing -l
|
151
|
+
complete -c doing -l finished -f -r -n '__fish_doing_using_command done did' -d Set\ finish\ date\ to\ specific\ date/time
|
152
152
|
complete -c doing -l started -f -r -n '__fish_doing_using_command done did' -d Backdate\ start\ date\ by\ interval\ or\ set\ to\ time\ \[4pm\|20m\|2h\|\"yesterday\ noon\"\]
|
153
153
|
complete -c doing -l date -f -n '__fish_doing_using_command done did' -d Include\ date
|
154
154
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command done did' -d Edit\ entry\ with\ vim
|
155
|
+
complete -c doing -l from -f -r -n '__fish_doing_using_command done did' -d Start\ and\ end\ times\ as\ a\ date/time\ range\ \`doing\ done\ --from\ \"1am\ to\ 8am\"\`
|
155
156
|
complete -c doing -l note -s n -f -r -n '__fish_doing_using_command done did' -d Include\ a\ note
|
156
157
|
complete -c doing -l remove -s r -f -n '__fish_doing_using_command done did' -d Remove\ @done\ tag
|
157
158
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command done did' -d Section
|
@@ -182,6 +183,7 @@ complete -c doing -l delete -s d -f -n '__fish_doing_using_command grep search'
|
|
182
183
|
complete -c doing -l duration -f -n '__fish_doing_using_command grep search' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
|
183
184
|
complete -c doing -l editor -s e -f -n '__fish_doing_using_command grep search' -d Edit\ matching\ entries\ with\ vim
|
184
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
|
185
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
|
186
188
|
complete -c doing -l not -f -n '__fish_doing_using_command grep search' -d Show\ items\ that\ \*don\'t\*\ match\ search\ string
|
187
189
|
complete -c doing -l output -s o -f -r -n '__fish_doing_using_command grep search' -d Output\ to\ export\ format
|
@@ -212,6 +214,7 @@ complete -c doing -l case -f -r -n '__fish_doing_using_command last' -d Case\ s
|
|
212
214
|
complete -c doing -l delete -s d -f -n '__fish_doing_using_command last' -d Delete\ the\ last\ entry
|
213
215
|
complete -c doing -l duration -f -n '__fish_doing_using_command last' -d Show\ elapsed\ time\ if\ entry\ is\ not\ tagged\ @done
|
214
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
|
215
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
|
216
219
|
complete -c doing -l section -s s -f -r -n '__fish_doing_using_command last' -d Specify\ a\ section
|
217
220
|
complete -c doing -l search -f -r -n '__fish_doing_using_command last' -d Search\ filter
|
@@ -330,6 +333,7 @@ complete -c doing -l count -s c -f -r -n '__fish_doing_using_command show' -d Ma
|
|
330
333
|
complete -c doing -l case -f -r -n '__fish_doing_using_command show' -d Case\ sensitivity\ for\ search\ string\ matching\ \[\(c\)ase-sensitive
|
331
334
|
complete -c doing -l duration -f -n '__fish_doing_using_command show' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
|
332
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
|
333
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
|
334
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
|
335
339
|
complete -c doing -l not -f -n '__fish_doing_using_command show' -d Show\ items\ that\ \*don\'t\*\ match\ search/tag/date\ filters
|
@@ -407,6 +411,7 @@ complete -c doing -l case -f -r -n '__fish_doing_using_command view' -d Case\ s
|
|
407
411
|
complete -c doing -l color -f -n '__fish_doing_using_command view' -d Include\ colors\ in\ output
|
408
412
|
complete -c doing -l duration -f -n '__fish_doing_using_command view' -d Show\ elapsed\ time\ on\ entries\ without\ @done\ tag
|
409
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
|
410
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
|
411
416
|
complete -c doing -l not -f -n '__fish_doing_using_command view' -d Show\ items\ that\ \*don\'t\*\ match\ search\ string
|
412
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'],
|
data/lib/doing/configuration.rb
CHANGED
@@ -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}>)
|
data/lib/doing/log_adapter.rb
CHANGED
@@ -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
|
data/lib/doing/prompt.rb
CHANGED
@@ -17,13 +17,63 @@ 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}"
|
23
24
|
$stdin.gets.strip
|
24
25
|
end
|
25
26
|
|
27
|
+
def read_line(prompt: 'Enter text', completions: [], default_response: '')
|
28
|
+
$stdin.reopen('/dev/tty')
|
29
|
+
return default_response if @default_answer
|
30
|
+
|
31
|
+
unless completions.empty?
|
32
|
+
completions.sort!
|
33
|
+
comp = proc { |s| completions.grep(/^#{Regexp.escape(s)}/) }
|
34
|
+
Readline.completion_append_character = ' '
|
35
|
+
Readline.completion_proc = comp
|
36
|
+
end
|
37
|
+
|
38
|
+
begin
|
39
|
+
Readline.readline("#{yellow(prompt).sub(/:?$/, ':')} #{reset}", true).strip
|
40
|
+
rescue Interrupt
|
41
|
+
raise UserCancelled
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def read_lines(prompt: 'Enter text', completions: [])
|
46
|
+
$stdin.reopen('/dev/tty')
|
47
|
+
return default_response if @default_answer
|
48
|
+
|
49
|
+
completions.sort!
|
50
|
+
comp = proc { |s| completions.grep(/^#{Regexp.escape(s)}/) }
|
51
|
+
Readline.completion_append_character = ' '
|
52
|
+
Readline.completion_proc = comp
|
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('')
|
59
|
+
|
60
|
+
res = []
|
61
|
+
|
62
|
+
begin
|
63
|
+
while (line = Readline.readline('> ', true))
|
64
|
+
break if line.strip.empty?
|
65
|
+
|
66
|
+
res << line.chomp
|
67
|
+
end
|
68
|
+
rescue Interrupt
|
69
|
+
raise UserCancelled
|
70
|
+
end
|
71
|
+
|
72
|
+
res.join("\n").strip
|
73
|
+
end
|
74
|
+
|
26
75
|
def request_lines(prompt: 'Enter text')
|
76
|
+
$stdin.reopen('/dev/tty')
|
27
77
|
ask_note = []
|
28
78
|
reader = TTY::Reader.new(interrupt: -> { raise Errors::UserCancelled }, track_history: false)
|
29
79
|
puts "#{boldgreen(prompt.sub(/:?$/, ':'))} #{yellow('Hit return for a new line, ')}#{boldwhite('enter a blank line (')}#{boldyellow('return twice')}#{boldwhite(') to end editing')}"
|
@@ -51,6 +101,8 @@ module Doing
|
|
51
101
|
return @force_answer
|
52
102
|
end
|
53
103
|
|
104
|
+
$stdin.reopen('/dev/tty')
|
105
|
+
|
54
106
|
default = if default_response.is_a?(String)
|
55
107
|
default_response =~ /y/i ? true : false
|
56
108
|
else
|
data/lib/doing/string.rb
CHANGED
@@ -101,6 +101,49 @@ 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
|
+
qs = []
|
137
|
+
qs.concat(query[:must]) if query[:must]
|
138
|
+
qs.concat(query[:should]) if query[:should]
|
139
|
+
qs.each do |s|
|
140
|
+
rx = Regexp.new(s.wildcard_to_rx, ignore_case(s, case_type))
|
141
|
+
out.gsub!(rx) { |m| m.bgyellow.black }
|
142
|
+
end
|
143
|
+
end
|
144
|
+
out
|
145
|
+
end
|
146
|
+
|
104
147
|
##
|
105
148
|
## Test if line should be ignored
|
106
149
|
##
|
@@ -151,5 +151,33 @@ module Doing
|
|
151
151
|
parsed_date.nil? ? m[0] : "@#{t}(#{parsed_date.strftime('%F %R')})"
|
152
152
|
end
|
153
153
|
end
|
154
|
+
|
155
|
+
##
|
156
|
+
## Splits a range string and returns an array of
|
157
|
+
## DateTime objects as [start, end]. If only one date is
|
158
|
+
## given, end time is nil.
|
159
|
+
##
|
160
|
+
## @return [Array<DateTime>] Start and end dates as
|
161
|
+
## array
|
162
|
+
## @example Process a natural language date range
|
163
|
+
## "mon 3pm to mon 5pm".split_date_range
|
164
|
+
##
|
165
|
+
def split_date_range
|
166
|
+
date_string = dup
|
167
|
+
case date_string
|
168
|
+
when / (to|through|thru|(un)?til|-+) /
|
169
|
+
dates = date_string.split(/ (?:to|through|thru|(?:un)?til|-+) /)
|
170
|
+
start = dates[0].chronify(guess: :begin)
|
171
|
+
finish = dates[-1].chronify(guess: :end)
|
172
|
+
else
|
173
|
+
start = date_string.chronify(guess: :begin)
|
174
|
+
finish = nil
|
175
|
+
end
|
176
|
+
|
177
|
+
raise InvalidTimeExpression, 'Unrecognized date string' unless start
|
178
|
+
|
179
|
+
Doing.logger.debug('Parser:', "date range interpreted as #{start.strftime('%F %R')} -- #{finish ? finish.strftime('%F %R') : 'now'}")
|
180
|
+
[start, finish]
|
181
|
+
end
|
154
182
|
end
|
155
183
|
end
|
@@ -176,7 +176,7 @@ module Doing
|
|
176
176
|
' '
|
177
177
|
else
|
178
178
|
line = l.gsub(/%/, '\%').strip.wrap(width, pad: pad, indent: indent, offset: 0, prefix: prefix, color: last_color, after: after, reset: reset, pad_first: true)
|
179
|
-
line.highlight_tags!(tags_color, last_color: last_color) unless tags_color.nil? || tags_color.empty?
|
179
|
+
line.highlight_tags!(tags_color, last_color: last_color) unless !tags_color || tags_color.nil? || tags_color.empty?
|
180
180
|
"#{line} "
|
181
181
|
end
|
182
182
|
end.join("\n")
|
data/lib/doing/version.rb
CHANGED