doing 2.1.6 → 2.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardoc/checksums +9 -9
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/CHANGELOG.md +33 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/Rakefile +12 -1
- data/bin/doing +29 -2
- 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 +1 -1
- data/docs/doc/Doing/Completion.html +1 -1
- data/docs/doc/Doing/Configuration.html +2 -2
- 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 +1 -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 +132 -18
- data/docs/doc/Doing/Section.html +1 -1
- data/docs/doc/Doing/TemplateString.html +2 -2
- data/docs/doc/Doing/Util/Backup.html +79 -2
- data/docs/doc/Doing/Util.html +1 -1
- data/docs/doc/Doing/WWID.html +90 -77
- 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/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 +97 -1
- data/docs/doc/Symbol.html +36 -2
- 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 +299 -235
- data/docs/doc/top-level-namespace.html +1 -1
- data/docs/index.md +1 -1
- data/doing.rdoc +9 -2
- data/generate_completions.sh +1 -3
- data/lib/completion/_doing.zsh +1 -1
- data/lib/completion/doing.bash +2 -2
- data/lib/completion/doing.fish +2 -1
- data/lib/doing/completion/bash_completion.rb +2 -2
- data/lib/doing/completion/fish_completion.rb +2 -2
- data/lib/doing/completion/zsh_completion.rb +2 -2
- data/lib/doing/completion.rb +12 -2
- data/lib/doing/configuration.rb +1 -1
- data/lib/doing/log_adapter.rb +1 -0
- data/lib/doing/prompt.rb +47 -8
- data/lib/doing/string.rb +20 -0
- data/lib/doing/symbol.rb +4 -0
- data/lib/doing/util_backup.rb +22 -3
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +75 -45
- data/scripts/generate_bash_completions.rb +2 -2
- metadata +2 -3
- data/lib/helpers/fuzzyfilefinder +0 -0
data/lib/doing/wwid.rb
CHANGED
@@ -338,7 +338,8 @@ module Doing
|
|
338
338
|
## @option opt :back [Date] backdate
|
339
339
|
## @option opt :timed [Boolean] new item is timed entry, marks previous entry as @done
|
340
340
|
##
|
341
|
-
def add_item(title, section = nil, opt
|
341
|
+
def add_item(title, section = nil, opt)
|
342
|
+
opt ||= {}
|
342
343
|
section ||= @config['current_section']
|
343
344
|
@content.add_section(section, log: false)
|
344
345
|
opt[:back] ||= opt[:date] ? opt[:date] : Time.now
|
@@ -401,7 +402,8 @@ module Doing
|
|
401
402
|
## @param paths [String] Path to JSON report file
|
402
403
|
## @param opt [Hash] Additional Options
|
403
404
|
##
|
404
|
-
def import(paths, opt
|
405
|
+
def import(paths, opt)
|
406
|
+
opt ||= {}
|
405
407
|
Plugins.plugins[:import].each do |_, options|
|
406
408
|
next unless opt[:type] =~ /^(#{options[:trigger].normalize_trigger})$/i
|
407
409
|
|
@@ -461,7 +463,8 @@ module Doing
|
|
461
463
|
#
|
462
464
|
# @return nothing
|
463
465
|
#
|
464
|
-
def repeat_item(item, opt
|
466
|
+
def repeat_item(item, opt)
|
467
|
+
opt ||= {}
|
465
468
|
if item.should_finish?
|
466
469
|
if item.should_time?
|
467
470
|
item.title.tag!('done', value: Time.now.strftime('%F %R'))
|
@@ -501,7 +504,8 @@ module Doing
|
|
501
504
|
##
|
502
505
|
## @param opt [Hash] Additional Options
|
503
506
|
##
|
504
|
-
def repeat_last(opt
|
507
|
+
def repeat_last(opt)
|
508
|
+
opt ||= {}
|
505
509
|
opt[:section] ||= 'all'
|
506
510
|
opt[:section] = guess_section(opt[:section])
|
507
511
|
opt[:note] ||= []
|
@@ -523,7 +527,8 @@ module Doing
|
|
523
527
|
##
|
524
528
|
## @param opt [Hash] Additional Options
|
525
529
|
##
|
526
|
-
def last_entry(opt
|
530
|
+
def last_entry(opt)
|
531
|
+
opt ||= {}
|
527
532
|
opt[:tag_bool] ||= :and
|
528
533
|
opt[:section] ||= @config['current_section']
|
529
534
|
|
@@ -615,19 +620,19 @@ module Doing
|
|
615
620
|
## @param items [Array] The items to filter (if empty, filters all items)
|
616
621
|
## @param opt [Hash] The filter parameters
|
617
622
|
##
|
618
|
-
## @option opt [String] :section
|
619
|
-
## @option opt [Boolean] :unfinished
|
620
|
-
## @option opt [Array or String] :tag
|
621
|
-
## @option opt [Symbol] :tag_bool
|
622
|
-
## @option opt [String] :search
|
623
|
-
## @option opt [Array] :date_filter
|
624
|
-
## @option opt [Boolean] :only_timed
|
625
|
-
## @option opt [String] :before
|
626
|
-
## @option opt [String] :after (Date/Time string, unparsed
|
627
|
-
## @option opt [Boolean] :today
|
628
|
-
## @option opt [Boolean] :yesterday
|
629
|
-
## @option opt [Number] :count
|
630
|
-
## @option opt [String] :age
|
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'
|
631
636
|
##
|
632
637
|
def filter_items(items = Items.new, opt: {})
|
633
638
|
time_rx = /^(\d{1,2}+(:\d{1,2}+)?( *(am|pm))?|midnight|noon)$/
|
@@ -784,7 +789,7 @@ module Doing
|
|
784
789
|
|
785
790
|
output = Items.new
|
786
791
|
|
787
|
-
if opt[:age]
|
792
|
+
if opt[:age] && opt[:age].normalize_age == :oldest
|
788
793
|
output.concat(filtered_items.slice(0, count).reverse)
|
789
794
|
else
|
790
795
|
output.concat(filtered_items.reverse.slice(0, count))
|
@@ -800,7 +805,8 @@ module Doing
|
|
800
805
|
##
|
801
806
|
## Options hash is shared with #filter_items and #act_on
|
802
807
|
##
|
803
|
-
def interactive(opt
|
808
|
+
def interactive(opt)
|
809
|
+
opt ||= {}
|
804
810
|
opt[:section] = opt[:section] ? guess_section(opt[:section]) : 'All'
|
805
811
|
|
806
812
|
search = nil
|
@@ -820,7 +826,11 @@ module Doing
|
|
820
826
|
}
|
821
827
|
items = filter_items(Items.new, opt: filter_options)
|
822
828
|
|
823
|
-
|
829
|
+
menu_options = %i[search query exact multiple show_if_single menu sort case].each_with_object({}) {
|
830
|
+
|k, hsh| hsh[k] = opt[k]
|
831
|
+
}
|
832
|
+
|
833
|
+
selection = Prompt.choose_from_items(items, include_section: opt[:section] =~ /^all$/i, **menu_options)
|
824
834
|
|
825
835
|
raise NoResults, 'no items selected' if selection.nil? || selection.empty?
|
826
836
|
|
@@ -848,7 +858,8 @@ module Doing
|
|
848
858
|
## @option opt [Boolean] :again
|
849
859
|
## @option opt [Boolean] :resume
|
850
860
|
##
|
851
|
-
def act_on(items, opt
|
861
|
+
def act_on(items, opt)
|
862
|
+
opt ||= {}
|
852
863
|
actions = %i[editor delete tag flag finish cancel archive output save_to again resume]
|
853
864
|
has_action = false
|
854
865
|
single = items.count == 1
|
@@ -1105,7 +1116,8 @@ module Doing
|
|
1105
1116
|
##
|
1106
1117
|
## @see #filter_items
|
1107
1118
|
##
|
1108
|
-
def tag_last(opt
|
1119
|
+
def tag_last(opt)
|
1120
|
+
opt ||= {}
|
1109
1121
|
opt[:count] ||= 1
|
1110
1122
|
opt[:archive] ||= false
|
1111
1123
|
opt[:tags] ||= ['done']
|
@@ -1229,7 +1241,8 @@ module Doing
|
|
1229
1241
|
##
|
1230
1242
|
## @return [Item] the next chronological item in the index
|
1231
1243
|
##
|
1232
|
-
def next_item(item, options
|
1244
|
+
def next_item(item, options)
|
1245
|
+
options ||= {}
|
1233
1246
|
items = filter_items(Items.new, opt: options)
|
1234
1247
|
|
1235
1248
|
idx = items.index(item)
|
@@ -1287,7 +1300,8 @@ module Doing
|
|
1287
1300
|
## @option opt :back [Date] backdate new item
|
1288
1301
|
## @option opt :new_item [String] content to use for new item
|
1289
1302
|
## @option opt :note [Array] note content for new item
|
1290
|
-
def stop_start(target_tag, opt
|
1303
|
+
def stop_start(target_tag, opt)
|
1304
|
+
opt ||= {}
|
1291
1305
|
tag = target_tag.dup
|
1292
1306
|
opt[:section] ||= @config['current_section']
|
1293
1307
|
opt[:archive] ||= false
|
@@ -1354,7 +1368,8 @@ module Doing
|
|
1354
1368
|
##
|
1355
1369
|
## Rename doing file with date and start fresh one
|
1356
1370
|
##
|
1357
|
-
def rotate(opt
|
1371
|
+
def rotate(opt)
|
1372
|
+
opt ||= {}
|
1358
1373
|
keep = opt[:keep] || 0
|
1359
1374
|
tags = []
|
1360
1375
|
tags.concat(opt[:tag].split(/ *, */).map { |t| t.sub(/^@/, '').strip }) if opt[:tag]
|
@@ -1369,7 +1384,7 @@ module Doing
|
|
1369
1384
|
counter = 0
|
1370
1385
|
new_content = Items.new
|
1371
1386
|
|
1372
|
-
|
1387
|
+
section_items.each do |item|
|
1373
1388
|
break if counter >= max
|
1374
1389
|
if opt[:before]
|
1375
1390
|
time_string = opt[:before]
|
@@ -1482,7 +1497,7 @@ module Doing
|
|
1482
1497
|
##
|
1483
1498
|
## @param opt [Hash] Additional Options
|
1484
1499
|
##
|
1485
|
-
def list_section(opt
|
1500
|
+
def list_section(opt, items: Items.new)
|
1486
1501
|
opt[:config_template] ||= 'default'
|
1487
1502
|
|
1488
1503
|
tpl_cfg = @config.dig('templates', opt[:config_template])
|
@@ -1504,7 +1519,8 @@ module Doing
|
|
1504
1519
|
opt[:duration] ||= cfg['duration'] || false
|
1505
1520
|
opt[:interval_format] ||= cfg['interval_format'] || 'text'
|
1506
1521
|
opt[:count] ||= 0
|
1507
|
-
opt[:age] ||=
|
1522
|
+
opt[:age] ||= :newest
|
1523
|
+
opt[:age] = opt[:age].normalize_age
|
1508
1524
|
opt[:format] ||= cfg['date_format']
|
1509
1525
|
opt[:order] ||= cfg['order'] || 'asc'
|
1510
1526
|
opt[:tag_order] ||= 'asc'
|
@@ -1559,7 +1575,8 @@ module Doing
|
|
1559
1575
|
## @param section [String] The source section
|
1560
1576
|
## @param options [Hash] Options
|
1561
1577
|
##
|
1562
|
-
def archive(section = @config['current_section'], options
|
1578
|
+
def archive(section = @config['current_section'], options)
|
1579
|
+
options ||= {}
|
1563
1580
|
count = options[:keep] || 0
|
1564
1581
|
destination = options[:destination] || 'Archive'
|
1565
1582
|
tags = options[:tags] || []
|
@@ -1589,7 +1606,8 @@ module Doing
|
|
1589
1606
|
## @param output [String] output format
|
1590
1607
|
## @param opt [Hash] Options
|
1591
1608
|
##
|
1592
|
-
def today(times = true, output = nil, opt
|
1609
|
+
def today(times = true, output = nil, opt)
|
1610
|
+
opt ||= {}
|
1593
1611
|
opt[:totals] ||= false
|
1594
1612
|
opt[:sort_tags] ||= false
|
1595
1613
|
|
@@ -1637,7 +1655,8 @@ module Doing
|
|
1637
1655
|
## @param output [String] Output format
|
1638
1656
|
## @param opt [Hash] Additional Options
|
1639
1657
|
##
|
1640
|
-
def list_date(dates, section, times = nil, output = nil, opt
|
1658
|
+
def list_date(dates, section, times = nil, output = nil, opt)
|
1659
|
+
opt ||= {}
|
1641
1660
|
opt[:totals] ||= false
|
1642
1661
|
opt[:sort_tags] ||= false
|
1643
1662
|
section = guess_section(section)
|
@@ -1666,7 +1685,8 @@ module Doing
|
|
1666
1685
|
## @param output [String] Output format
|
1667
1686
|
## @param opt [Hash] Additional Options
|
1668
1687
|
##
|
1669
|
-
def yesterday(section, times = nil, output = nil, opt
|
1688
|
+
def yesterday(section, times = nil, output = nil, opt)
|
1689
|
+
opt ||= {}
|
1670
1690
|
opt[:totals] ||= false
|
1671
1691
|
opt[:sort_tags] ||= false
|
1672
1692
|
section = guess_section(section)
|
@@ -1701,7 +1721,8 @@ module Doing
|
|
1701
1721
|
## @param section [String] The section to show from, default Currently
|
1702
1722
|
## @param opt [Hash] Additional Options
|
1703
1723
|
##
|
1704
|
-
def recent(count = 10, section = nil, opt
|
1724
|
+
def recent(count = 10, section = nil, opt)
|
1725
|
+
opt ||= {}
|
1705
1726
|
times = opt[:t] || true
|
1706
1727
|
opt[:totals] ||= false
|
1707
1728
|
opt[:sort_tags] ||= false
|
@@ -1720,10 +1741,16 @@ module Doing
|
|
1720
1741
|
section ||= @config['current_section']
|
1721
1742
|
section = guess_section(section)
|
1722
1743
|
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1744
|
+
opt[:section] = section
|
1745
|
+
opt[:wrap_width] = cfg['wrap_width']
|
1746
|
+
opt[:count] = count
|
1747
|
+
opt[:format] = cfg['date_format']
|
1748
|
+
opt[:template] = cfg['template']
|
1749
|
+
opt[:order] = 'asc'
|
1750
|
+
opt[:times] = times
|
1751
|
+
opt[:config_template] = 'recent'
|
1752
|
+
|
1753
|
+
list_section(opt)
|
1727
1754
|
end
|
1728
1755
|
|
1729
1756
|
##
|
@@ -1776,13 +1803,14 @@ module Doing
|
|
1776
1803
|
## Does not repeat tags in a title, and only converts the first instance of an
|
1777
1804
|
## untagged keyword
|
1778
1805
|
##
|
1779
|
-
## @param
|
1806
|
+
## @param string [String] The text to tag
|
1780
1807
|
##
|
1781
|
-
def autotag(
|
1782
|
-
return unless
|
1783
|
-
return
|
1808
|
+
def autotag(string)
|
1809
|
+
return unless string
|
1810
|
+
return string unless @auto_tag
|
1784
1811
|
|
1785
|
-
original =
|
1812
|
+
original = string.dup
|
1813
|
+
text = string.dup
|
1786
1814
|
|
1787
1815
|
current_tags = text.scan(/@\w+/).map { |t| t.sub(/^@/, '') }
|
1788
1816
|
tagged = {
|
@@ -2091,7 +2119,8 @@ EOS
|
|
2091
2119
|
## @return [String] formatted output based on opt[:output]
|
2092
2120
|
## template trigger
|
2093
2121
|
##
|
2094
|
-
def output(items, title, is_single, opt
|
2122
|
+
def output(items, title, is_single, opt)
|
2123
|
+
opt ||= {}
|
2095
2124
|
out = nil
|
2096
2125
|
|
2097
2126
|
raise InvalidArgument, 'Unknown output format' unless opt[:output] =~ Plugins.plugin_regex(type: :export)
|
@@ -2135,7 +2164,8 @@ EOS
|
|
2135
2164
|
## section
|
2136
2165
|
## @param opt [Hash] Additional Options
|
2137
2166
|
##
|
2138
|
-
def do_archive(section, destination, opt
|
2167
|
+
def do_archive(section, destination, opt)
|
2168
|
+
opt ||= {}
|
2139
2169
|
count = opt[:count] || 0
|
2140
2170
|
tags = opt[:tags] || []
|
2141
2171
|
bool = opt[:bool] || :and
|
@@ -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,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: safe_yaml
|
@@ -542,7 +542,6 @@ files:
|
|
542
542
|
- lib/examples/plugins/wiki_export/templates/wiki.haml
|
543
543
|
- lib/examples/plugins/wiki_export/templates/wiki_index.haml
|
544
544
|
- lib/examples/plugins/wiki_export/wiki_export.rb
|
545
|
-
- lib/helpers/fuzzyfilefinder
|
546
545
|
- lib/helpers/fzf/.goreleaser.yml
|
547
546
|
- lib/helpers/fzf/.rubocop.yml
|
548
547
|
- lib/helpers/fzf/ADVANCED.md
|
data/lib/helpers/fuzzyfilefinder
DELETED
Binary file
|