doing 2.1.26 → 2.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardoc/checksums +15 -20
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/CHANGELOG.md +52 -0
- data/Dockerfile +5 -5
- data/Dockerfile-2.6 +5 -5
- data/Dockerfile-2.7 +5 -4
- data/Dockerfile-3.0 +5 -4
- data/Gemfile.lock +2 -1
- data/README.md +1 -1
- data/Rakefile +2 -3
- data/bin/commands/add_section.rb +2 -0
- data/bin/commands/again.rb +23 -65
- data/bin/commands/archive.rb +20 -61
- data/bin/commands/cancel.rb +27 -69
- data/bin/commands/changes.rb +53 -12
- data/bin/commands/colors.rb +4 -2
- data/bin/commands/commands.rb +4 -2
- data/bin/commands/commands_accepting.rb +62 -11
- data/bin/commands/completion.rb +10 -7
- data/bin/commands/config.rb +8 -8
- data/bin/commands/done.rb +3 -17
- data/bin/commands/finish.rb +7 -30
- data/bin/commands/flag.rb +15 -51
- data/bin/commands/grep.rb +12 -28
- data/bin/commands/import.rb +3 -33
- data/bin/commands/last.rb +3 -36
- data/bin/commands/meanwhile.rb +3 -13
- data/bin/commands/note.rb +13 -52
- data/bin/commands/now.rb +15 -21
- data/bin/commands/on.rb +3 -4
- data/bin/commands/open.rb +3 -3
- data/bin/commands/recent.rb +3 -4
- data/bin/commands/redo.rb +6 -2
- data/bin/commands/reset.rb +19 -52
- data/bin/commands/rotate.rb +5 -36
- data/bin/commands/select.rb +23 -41
- data/bin/commands/show.rb +28 -74
- data/bin/commands/since.rb +3 -4
- data/bin/commands/tag.rb +4 -34
- data/bin/commands/tags.rb +5 -32
- data/bin/commands/today.rb +3 -4
- data/bin/commands/view.rb +36 -73
- data/bin/commands/yesterday.rb +4 -5
- data/bin/doing +150 -13
- data/docs/doc/Array.html +3 -502
- 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 +62 -56
- data/docs/doc/Doing/Completion.html +1 -1
- data/docs/doc/Doing/Configuration.html +35 -1
- 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 +2 -2
- data/docs/doc/Doing/LogAdapter.html +1 -1
- data/docs/doc/Doing/Note.html +2 -2
- data/docs/doc/Doing/Pager.html +1 -1
- data/docs/doc/Doing/Plugins.html +1 -1
- data/docs/doc/Doing/Prompt.html +1 -1
- data/docs/doc/Doing/Section.html +1 -1
- data/docs/doc/Doing/TemplateString.html +2 -2
- data/docs/doc/Doing/Types.html +41 -1
- data/docs/doc/Doing/Util/Backup.html +1 -1
- data/docs/doc/Doing/Util.html +1 -1
- data/docs/doc/Doing/WWID.html +10 -10
- data/docs/doc/Doing.html +3 -3
- data/docs/doc/FalseClass.html +35 -1
- data/docs/doc/GLI/Commands/Help.html +1 -1
- 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/Object.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 +287 -3155
- data/docs/doc/Symbol.html +40 -6
- data/docs/doc/Time.html +1 -1
- data/docs/doc/TrueClass.html +35 -1
- data/docs/doc/_index.html +5 -10
- data/docs/doc/class_list.html +1 -1
- data/docs/doc/file.README.html +2 -2
- data/docs/doc/index.html +2 -2
- data/docs/doc/method_list.html +278 -678
- data/docs/doc/top-level-namespace.html +2 -2
- data/doing.gemspec +1 -0
- data/doing.rdoc +297 -206
- data/lib/completion/_doing.zsh +32 -32
- data/lib/completion/doing.bash +30 -30
- data/lib/completion/doing.fish +87 -77
- data/lib/doing/array/array.rb +4 -0
- data/lib/doing/array/nested_hash.rb +17 -0
- data/lib/doing/{array.rb → array/tags.rb} +7 -25
- data/lib/doing/changelog/change.rb +26 -11
- data/lib/doing/changelog/changes.rb +37 -8
- data/lib/doing/changelog/version.rb +11 -3
- data/lib/doing/{array_chronify.rb → chronify/array.rb} +0 -0
- data/lib/doing/chronify/chronify.rb +5 -0
- data/lib/doing/{numeric_chronify.rb → chronify/numeric.rb} +0 -0
- data/lib/doing/{string_chronify.rb → chronify/string.rb} +0 -0
- data/lib/doing/colors.rb +115 -54
- data/lib/doing/completion/zsh_completion.rb +5 -0
- data/lib/doing/configuration.rb +9 -5
- data/lib/doing/good.rb +8 -0
- data/lib/doing/help_monkey_patch.rb +6 -5
- data/lib/doing/item.rb +5 -5
- data/lib/doing/items.rb +2 -2
- data/lib/doing/log_adapter.rb +35 -2
- data/lib/doing/normalize.rb +188 -0
- data/lib/doing/plugins/export/dayone_export.rb +1 -1
- data/lib/doing/plugins/export/html_export.rb +1 -1
- data/lib/doing/plugins/export/json_export.rb +1 -1
- data/lib/doing/plugins/export/markdown_export.rb +1 -1
- data/lib/doing/plugins/export/template_export.rb +3 -1
- data/lib/doing/prompt.rb +1 -3
- data/lib/doing/section.rb +1 -1
- data/lib/doing/string/highlight.rb +95 -0
- data/lib/doing/string/query.rb +129 -0
- data/lib/doing/string/string.rb +12 -0
- data/lib/doing/string/tags.rb +164 -0
- data/lib/doing/string/transform.rb +168 -0
- data/lib/doing/string/truncate.rb +75 -0
- data/lib/doing/string/url.rb +82 -0
- data/lib/doing/template_string.rb +0 -22
- data/lib/doing/types.rb +8 -0
- data/lib/doing/util.rb +13 -9
- data/lib/doing/version.rb +1 -1
- data/lib/doing/wwid.rb +54 -36
- data/lib/doing.rb +5 -6
- data/lib/examples/plugins/wiki_export/wiki_export.rb +1 -1
- data/lib/helpers/threaded_tests.rb +15 -2
- data/scripts/deploy.rb +107 -0
- data/scripts/runtests.sh +4 -0
- metadata +39 -8
- data/lib/doing/string.rb +0 -765
- data/lib/doing/symbol.rb +0 -28
|
@@ -4,21 +4,49 @@ module Doing
|
|
|
4
4
|
# A collection of Changes
|
|
5
5
|
class Changes
|
|
6
6
|
attr_reader :changes
|
|
7
|
+
attr_writer :changes_only
|
|
7
8
|
|
|
8
|
-
def initialize(lookup: nil, search: nil)
|
|
9
|
+
def initialize(lookup: nil, search: nil, changes: false, sort: :desc)
|
|
10
|
+
@changes_only = changes
|
|
9
11
|
changelog = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'CHANGELOG.md'))
|
|
10
12
|
raise 'Error locating changelog' unless File.exist?(changelog)
|
|
11
13
|
|
|
12
14
|
@content = IO.read(changelog)
|
|
13
15
|
parse_changes(lookup, search)
|
|
16
|
+
|
|
17
|
+
@changes.reverse! if sort == :asc
|
|
14
18
|
end
|
|
15
19
|
|
|
16
20
|
def latest
|
|
17
|
-
@
|
|
21
|
+
if @changes_only
|
|
22
|
+
@changes[0].changes_only.force_encoding('utf-8')
|
|
23
|
+
else
|
|
24
|
+
@changes[0].to_s.force_encoding('utf-8')
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def versions
|
|
29
|
+
@changes.select { |change| change.entries&.count > 0 }.map { |change| change.version }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def interactive
|
|
33
|
+
Doing::Prompt.choose_from(versions,
|
|
34
|
+
prompt: 'Select a version to see its changelog',
|
|
35
|
+
sorted: false,
|
|
36
|
+
fzf_args: [
|
|
37
|
+
%(--preview='doing changes --render -l {1}'),
|
|
38
|
+
'--disabled',
|
|
39
|
+
'--height=50',
|
|
40
|
+
'--preview-window="right,70%"'
|
|
41
|
+
])
|
|
18
42
|
end
|
|
19
43
|
|
|
20
44
|
def to_s
|
|
21
|
-
@
|
|
45
|
+
if @changes_only
|
|
46
|
+
@changes.map(&:changes_only).join().force_encoding('utf-8')
|
|
47
|
+
else
|
|
48
|
+
@changes.map(&:to_s).join("\n\n").force_encoding('utf-8')
|
|
49
|
+
end
|
|
22
50
|
end
|
|
23
51
|
|
|
24
52
|
private
|
|
@@ -38,18 +66,19 @@ module Doing
|
|
|
38
66
|
def lookup(lookup_version)
|
|
39
67
|
range = []
|
|
40
68
|
|
|
41
|
-
if lookup_version =~ /([\d.]+)
|
|
69
|
+
if lookup_version =~ /([\d.]+) *(?:-|to)+ *([\d.]+)/
|
|
42
70
|
m = Regexp.last_match
|
|
43
71
|
lookup("> #{m[1]}")
|
|
44
72
|
lookup("< #{m[2]}")
|
|
45
|
-
elsif lookup_version.scan(/[
|
|
46
|
-
params = lookup_version.scan(/
|
|
73
|
+
elsif lookup_version.scan(/(?:<=?|prior|before|older|>=?|since|after|newer) *[0-9*?.]+/).count > 1
|
|
74
|
+
params = lookup_version.scan(/(?:<=?|prior|before|older|>=?|since|after|newer) *[0-9*?.]+/)
|
|
47
75
|
params.each { |query| lookup(query) }
|
|
48
76
|
else
|
|
77
|
+
inclusive = lookup_version =~ /=/ ? true : false
|
|
49
78
|
comp = case lookup_version
|
|
50
79
|
when /(<|prior|before|older)/
|
|
51
80
|
:older
|
|
52
|
-
when
|
|
81
|
+
when /(>|since|after|newer)/
|
|
53
82
|
:newer
|
|
54
83
|
else
|
|
55
84
|
:equal
|
|
@@ -57,7 +86,7 @@ module Doing
|
|
|
57
86
|
version = Version.new(lookup_version)
|
|
58
87
|
|
|
59
88
|
@changes.select! do |change|
|
|
60
|
-
change.version.compare(version, comp)
|
|
89
|
+
change.version.compare(version, comp, inclusive: inclusive)
|
|
61
90
|
end
|
|
62
91
|
end
|
|
63
92
|
end
|
|
@@ -37,7 +37,7 @@ module Doing
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
def compare(other, comp)
|
|
40
|
+
def compare(other, comp, inclusive: false)
|
|
41
41
|
case comp
|
|
42
42
|
when :older
|
|
43
43
|
if @maj <= other.maj
|
|
@@ -46,7 +46,11 @@ module Doing
|
|
|
46
46
|
elsif @maj == other.maj && (other.min.nil? || @min < other.min)
|
|
47
47
|
true
|
|
48
48
|
elsif @maj == other.maj && @min == other.min
|
|
49
|
-
other.patch.nil?
|
|
49
|
+
if other.patch.nil?
|
|
50
|
+
false
|
|
51
|
+
else
|
|
52
|
+
inclusive ? @patch <= other.patch : @patch < other.patch
|
|
53
|
+
end
|
|
50
54
|
else
|
|
51
55
|
false
|
|
52
56
|
end
|
|
@@ -60,7 +64,11 @@ module Doing
|
|
|
60
64
|
elsif @maj == other.maj && (other.min.nil? || @min > other.min)
|
|
61
65
|
true
|
|
62
66
|
elsif @maj == other.maj && @min == other.min
|
|
63
|
-
other.patch.nil?
|
|
67
|
+
if other.patch.nil?
|
|
68
|
+
false
|
|
69
|
+
else
|
|
70
|
+
inclusive ? @patch >= other.patch : @patch > other.patch
|
|
71
|
+
end
|
|
64
72
|
else
|
|
65
73
|
false
|
|
66
74
|
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
data/lib/doing/colors.rb
CHANGED
|
@@ -6,61 +6,67 @@ module Doing
|
|
|
6
6
|
module Color
|
|
7
7
|
# :stopdoc:
|
|
8
8
|
ATTRIBUTES = [
|
|
9
|
-
[:clear,
|
|
10
|
-
[:reset,
|
|
11
|
-
[:bold,
|
|
12
|
-
[:dark,
|
|
13
|
-
[:italic,
|
|
14
|
-
[:underline,
|
|
15
|
-
[:underscore,
|
|
16
|
-
[:blink,
|
|
17
|
-
[:rapid_blink,
|
|
18
|
-
[:negative,
|
|
19
|
-
[:concealed,
|
|
20
|
-
[:strikethrough,
|
|
21
|
-
[:
|
|
22
|
-
[:
|
|
23
|
-
[:
|
|
24
|
-
[:
|
|
25
|
-
[:
|
|
26
|
-
[:
|
|
27
|
-
[:
|
|
28
|
-
[:
|
|
29
|
-
[:
|
|
30
|
-
[:
|
|
31
|
-
[:
|
|
32
|
-
[:
|
|
33
|
-
[:
|
|
34
|
-
[:
|
|
35
|
-
[:
|
|
36
|
-
[:
|
|
37
|
-
[:
|
|
38
|
-
[:
|
|
39
|
-
[:
|
|
40
|
-
[:
|
|
41
|
-
[:
|
|
42
|
-
[:
|
|
43
|
-
[:
|
|
44
|
-
[:
|
|
45
|
-
[:
|
|
46
|
-
[:
|
|
47
|
-
[:
|
|
48
|
-
[:
|
|
49
|
-
[:
|
|
50
|
-
[:
|
|
51
|
-
[:
|
|
52
|
-
[:
|
|
53
|
-
[:
|
|
54
|
-
[:
|
|
55
|
-
[:
|
|
56
|
-
[:
|
|
57
|
-
[:
|
|
58
|
-
[:
|
|
9
|
+
[:clear, 0], # String#clear is already used to empty string in Ruby 1.9
|
|
10
|
+
[:reset, 0], # synonym for :clear
|
|
11
|
+
[:bold, 1],
|
|
12
|
+
[:dark, 2],
|
|
13
|
+
[:italic, 3], # not widely implemented
|
|
14
|
+
[:underline, 4],
|
|
15
|
+
[:underscore, 4], # synonym for :underline
|
|
16
|
+
[:blink, 5],
|
|
17
|
+
[:rapid_blink, 6], # not widely implemented
|
|
18
|
+
[:negative, 7], # no reverse because of String#reverse
|
|
19
|
+
[:concealed, 8],
|
|
20
|
+
[:strikethrough, 9], # not widely implemented
|
|
21
|
+
[:strike, 9], # not widely implemented
|
|
22
|
+
[:black, 30],
|
|
23
|
+
[:red, 31],
|
|
24
|
+
[:green, 32],
|
|
25
|
+
[:yellow, 33],
|
|
26
|
+
[:blue, 34],
|
|
27
|
+
[:magenta, 35],
|
|
28
|
+
[:purple, 35],
|
|
29
|
+
[:cyan, 36],
|
|
30
|
+
[:white, 37],
|
|
31
|
+
[:bgblack, 40],
|
|
32
|
+
[:bgred, 41],
|
|
33
|
+
[:bggreen, 42],
|
|
34
|
+
[:bgyellow, 43],
|
|
35
|
+
[:bgblue, 44],
|
|
36
|
+
[:bgmagenta, 45],
|
|
37
|
+
[:bgpurple, 45],
|
|
38
|
+
[:bgcyan, 46],
|
|
39
|
+
[:bgwhite, 47],
|
|
40
|
+
[:boldblack, 90],
|
|
41
|
+
[:boldred, 91],
|
|
42
|
+
[:boldgreen, 92],
|
|
43
|
+
[:boldyellow, 93],
|
|
44
|
+
[:boldblue, 94],
|
|
45
|
+
[:boldmagenta, 95],
|
|
46
|
+
[:boldpurple, 95],
|
|
47
|
+
[:boldcyan, 96],
|
|
48
|
+
[:boldwhite, 97],
|
|
49
|
+
[:boldbgblack, 100],
|
|
50
|
+
[:boldbgred, 101],
|
|
51
|
+
[:boldbggreen, 102],
|
|
52
|
+
[:boldbgyellow, 103],
|
|
53
|
+
[:boldbgblue, 104],
|
|
54
|
+
[:boldbgmagenta, 105],
|
|
55
|
+
[:boldbgpurple, 105],
|
|
56
|
+
[:boldbgcyan, 106],
|
|
57
|
+
[:boldbgwhite, 107],
|
|
58
|
+
[:softpurple, '0;35;40'],
|
|
59
|
+
[:hotpants, '7;34;40'],
|
|
59
60
|
[:knightrider, '7;30;40'],
|
|
60
|
-
[:flamingo,
|
|
61
|
-
[:yeller,
|
|
62
|
-
[:whiteboard,
|
|
63
|
-
[:
|
|
61
|
+
[:flamingo, '7;31;47'],
|
|
62
|
+
[:yeller, '1;37;43'],
|
|
63
|
+
[:whiteboard, '1;30;47'],
|
|
64
|
+
[:chalkboard, '1;37;40'],
|
|
65
|
+
[:led, '0;32;40'],
|
|
66
|
+
[:redacted, '0;30;40'],
|
|
67
|
+
[:alert, '1;31;43'],
|
|
68
|
+
[:error, '1;37;41'],
|
|
69
|
+
[:default, '0;39']
|
|
64
70
|
].map(&:freeze).freeze
|
|
65
71
|
|
|
66
72
|
ATTRIBUTE_NAMES = ATTRIBUTES.transpose.first
|
|
@@ -78,6 +84,40 @@ module Doing
|
|
|
78
84
|
end
|
|
79
85
|
end
|
|
80
86
|
|
|
87
|
+
# Template coloring
|
|
88
|
+
class ::String
|
|
89
|
+
##
|
|
90
|
+
## Extract the longest valid %color name from a string.
|
|
91
|
+
##
|
|
92
|
+
## Allows %colors to bleed into other text and still
|
|
93
|
+
## be recognized, e.g. %greensomething still finds
|
|
94
|
+
## %green.
|
|
95
|
+
##
|
|
96
|
+
## @return [String] a valid color name
|
|
97
|
+
##
|
|
98
|
+
def validate_color
|
|
99
|
+
valid_color = nil
|
|
100
|
+
compiled = ''
|
|
101
|
+
normalize_color.split('').each do |char|
|
|
102
|
+
compiled += char
|
|
103
|
+
valid_color = compiled if Color.attributes.include?(compiled.to_sym)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
valid_color
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
##
|
|
110
|
+
## Normalize a color name, removing underscores,
|
|
111
|
+
## replacing "bright" with "bold", and converting
|
|
112
|
+
## bgbold to boldbg
|
|
113
|
+
##
|
|
114
|
+
## @return [String] Normalized color name
|
|
115
|
+
##
|
|
116
|
+
def normalize_color
|
|
117
|
+
gsub(/_/, '').sub(/bright/i, 'bold').sub(/bgbold/, 'boldbg')
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
81
121
|
class << self
|
|
82
122
|
# Returns true, if the coloring function of this module
|
|
83
123
|
# is switched on, false otherwise.
|
|
@@ -113,6 +153,27 @@ module Doing
|
|
|
113
153
|
result
|
|
114
154
|
end
|
|
115
155
|
EOT
|
|
156
|
+
|
|
157
|
+
# Accept brightwhite in addition to boldwhite
|
|
158
|
+
if c =~ /bold/
|
|
159
|
+
eval <<-EOT
|
|
160
|
+
def #{c.to_s.sub(/bold/, 'bright')}(string = nil)
|
|
161
|
+
result = ''
|
|
162
|
+
result << "\e[#{v}m" if Doing::Color.coloring?
|
|
163
|
+
if block_given?
|
|
164
|
+
result << yield
|
|
165
|
+
elsif string.respond_to?(:to_str)
|
|
166
|
+
result << string.to_str
|
|
167
|
+
elsif respond_to?(:to_str)
|
|
168
|
+
result << to_str
|
|
169
|
+
else
|
|
170
|
+
return result #only switch on
|
|
171
|
+
end
|
|
172
|
+
result << "\e[0m" if Doing::Color.coloring?
|
|
173
|
+
result
|
|
174
|
+
end
|
|
175
|
+
EOT
|
|
176
|
+
end
|
|
116
177
|
end
|
|
117
178
|
|
|
118
179
|
# Regular expression that is used to scan for ANSI-sequences while
|
|
@@ -68,6 +68,11 @@ module Doing
|
|
|
68
68
|
|
|
69
69
|
def parse_command(command)
|
|
70
70
|
res = command.match(/^(?<cmd>[^, \t]+)(?<alias>(?:, [^, \t]+)*)?\s+- (?<desc>.*?)$/)
|
|
71
|
+
if res.nil?
|
|
72
|
+
Doing.logger.error('Completion:', "Error parsing #{command}")
|
|
73
|
+
return nil
|
|
74
|
+
|
|
75
|
+
end
|
|
71
76
|
commands = [res['cmd']]
|
|
72
77
|
commands.concat(res['alias'].split(/, /).delete_if(&:empty?)) if res['alias']
|
|
73
78
|
|
data/lib/doing/configuration.rb
CHANGED
|
@@ -179,6 +179,10 @@ module Doing
|
|
|
179
179
|
end
|
|
180
180
|
end
|
|
181
181
|
|
|
182
|
+
def fetch(*path, default)
|
|
183
|
+
@settings.dig(*path) || default
|
|
184
|
+
end
|
|
185
|
+
|
|
182
186
|
##
|
|
183
187
|
## Resolve a fuzzy-matched key path
|
|
184
188
|
##
|
|
@@ -216,9 +220,9 @@ module Doing
|
|
|
216
220
|
return nil unless create
|
|
217
221
|
end
|
|
218
222
|
|
|
219
|
-
resolved = real_path.count.positive? ? "Resolved #{real_path.join('
|
|
223
|
+
resolved = real_path.count.positive? ? "Resolved #{real_path.join('.')}, but " : ''
|
|
220
224
|
Doing.logger.log_now(:warn, "#{resolved}#{path} is unknown")
|
|
221
|
-
new_path = [*real_path, path, *paths].join('
|
|
225
|
+
new_path = [*real_path, path, *paths].join('.')
|
|
222
226
|
Doing.logger.log_now(:warn, "Continuing will create the path #{new_path}")
|
|
223
227
|
res = Prompt.yn('Key path not found, create it?', default_response: true)
|
|
224
228
|
raise InvalidArgument, 'Invalid key path' unless res
|
|
@@ -370,7 +374,7 @@ module Doing
|
|
|
370
374
|
deprecated = true
|
|
371
375
|
config['editors']['default'] ||= config['editor']
|
|
372
376
|
config.delete('editor')
|
|
373
|
-
Doing.logger.debug('Deprecated:', "config key 'editor' is now 'editors
|
|
377
|
+
Doing.logger.debug('Deprecated:', "config key 'editor' is now 'editors.default', please update your config.")
|
|
374
378
|
end
|
|
375
379
|
|
|
376
380
|
if config.key?('config_editor_app') && !config['editors']['config']
|
|
@@ -378,7 +382,7 @@ module Doing
|
|
|
378
382
|
config['editors']['config'] = config['config_editor_app']
|
|
379
383
|
config.delete('config_editor_app')
|
|
380
384
|
Doing.logger.debug('Deprecated:',
|
|
381
|
-
"config key 'config_editor_app' is now 'editors
|
|
385
|
+
"config key 'config_editor_app' is now 'editors.config', please update your config.")
|
|
382
386
|
end
|
|
383
387
|
|
|
384
388
|
if config.key?('editor_app') && !config['editors']['doing_file']
|
|
@@ -386,7 +390,7 @@ module Doing
|
|
|
386
390
|
config['editors']['doing_file'] = config['editor_app']
|
|
387
391
|
config.delete('editor_app')
|
|
388
392
|
Doing.logger.debug('Deprecated:',
|
|
389
|
-
"config key 'editor_app' is now 'editors
|
|
393
|
+
"config key 'editor_app' is now 'editors.doing_file', please update your config.")
|
|
390
394
|
end
|
|
391
395
|
|
|
392
396
|
Doing.logger.warn('Deprecated:', 'outdated keys found, please run `doing config --update`.') if deprecated
|
data/lib/doing/good.rb
CHANGED
|
@@ -48,6 +48,10 @@ module Doing
|
|
|
48
48
|
def good?
|
|
49
49
|
false
|
|
50
50
|
end
|
|
51
|
+
|
|
52
|
+
def normalize_tag_sort
|
|
53
|
+
:time
|
|
54
|
+
end
|
|
51
55
|
end
|
|
52
56
|
|
|
53
57
|
class ::TrueClass
|
|
@@ -60,5 +64,9 @@ module Doing
|
|
|
60
64
|
def good?
|
|
61
65
|
true
|
|
62
66
|
end
|
|
67
|
+
|
|
68
|
+
def normalize_tag_sort
|
|
69
|
+
:name
|
|
70
|
+
end
|
|
63
71
|
end
|
|
64
72
|
end
|
|
@@ -4,15 +4,15 @@ module GLI
|
|
|
4
4
|
module Commands
|
|
5
5
|
# Help Command Monkeypatch for paginated output
|
|
6
6
|
class Help < Command
|
|
7
|
-
def show_help(global_options,options,arguments,out,error)
|
|
7
|
+
def show_help(global_options, options, arguments, out, error)
|
|
8
8
|
Doing::Pager.paginate = true
|
|
9
9
|
|
|
10
|
-
command_finder = HelpModules::CommandFinder.new(@app,arguments,error)
|
|
10
|
+
command_finder = HelpModules::CommandFinder.new(@app, arguments, error)
|
|
11
11
|
if options[:c]
|
|
12
|
-
help_output = HelpModules::HelpCompletionFormat.new(@app,command_finder,arguments).format
|
|
12
|
+
help_output = HelpModules::HelpCompletionFormat.new(@app, command_finder, arguments).format
|
|
13
13
|
out.puts help_output unless help_output.nil?
|
|
14
14
|
elsif arguments.empty? || options[:c]
|
|
15
|
-
Doing::Pager.page HelpModules::GlobalHelpFormat.new(@app
|
|
15
|
+
Doing::Pager.page HelpModules::GlobalHelpFormat.new(@app, @sorter, @text_wrapping_class).format
|
|
16
16
|
else
|
|
17
17
|
name = arguments.shift
|
|
18
18
|
command = command_finder.find_command(name)
|
|
@@ -22,7 +22,8 @@ module GLI
|
|
|
22
22
|
@app,
|
|
23
23
|
@sorter,
|
|
24
24
|
@synopsis_formatter_class,
|
|
25
|
-
@text_wrapping_class
|
|
25
|
+
@text_wrapping_class
|
|
26
|
+
).format
|
|
26
27
|
end
|
|
27
28
|
end
|
|
28
29
|
end
|
data/lib/doing/item.rb
CHANGED
|
@@ -177,7 +177,7 @@ module Doing
|
|
|
177
177
|
tags.each do |tag|
|
|
178
178
|
bool = remove ? :and : :not
|
|
179
179
|
if tags?(tag, bool)
|
|
180
|
-
@title.tag
|
|
180
|
+
@title = @title.tag(tag, **options).strip
|
|
181
181
|
remove ? removed.push(tag) : added.push(tag)
|
|
182
182
|
end
|
|
183
183
|
end
|
|
@@ -278,7 +278,7 @@ module Doing
|
|
|
278
278
|
case_type ||= prefs.fetch('case', 'smart').normalize_case
|
|
279
279
|
new_note = Note.new
|
|
280
280
|
|
|
281
|
-
if search.
|
|
281
|
+
if search.rx? || matching == :fuzzy
|
|
282
282
|
rx = search.to_rx(distance: distance, case_type: case_type)
|
|
283
283
|
new_title = @title.gsub(rx) { |m| yellow(m) }
|
|
284
284
|
new_note.add(@note.to_s.gsub(rx) { |m| yellow(m) })
|
|
@@ -316,7 +316,7 @@ module Doing
|
|
|
316
316
|
distance ||= prefs.fetch('distance', 3).to_i
|
|
317
317
|
case_type ||= prefs.fetch('case', 'smart').normalize_case
|
|
318
318
|
|
|
319
|
-
if search.
|
|
319
|
+
if search.rx? || matching == :fuzzy
|
|
320
320
|
matches = @title + @note.to_s =~ search.to_rx(distance: distance, case_type: case_type)
|
|
321
321
|
else
|
|
322
322
|
query = search.strip.to_phrase_query
|
|
@@ -335,7 +335,7 @@ module Doing
|
|
|
335
335
|
# matches = text =~ search.to_rx(distance: distance, case_type: case_type)
|
|
336
336
|
# end
|
|
337
337
|
|
|
338
|
-
# if search.
|
|
338
|
+
# if search.rx? || !fuzzy
|
|
339
339
|
# matches = text =~ search.to_rx(distance: distance, case_type: case_type)
|
|
340
340
|
# else
|
|
341
341
|
# distance = 0.25 if distance > 1
|
|
@@ -393,7 +393,7 @@ module Doing
|
|
|
393
393
|
|
|
394
394
|
Doing.logger.count(@section == 'Archive' ? :archived : :moved) if log
|
|
395
395
|
Doing.logger.debug("#{@section == 'Archive' ? 'Archived' : 'Moved'}:",
|
|
396
|
-
"#{@title.
|
|
396
|
+
"#{@title.trunc(60)} from #{from} to #{@section}")
|
|
397
397
|
self
|
|
398
398
|
end
|
|
399
399
|
|
data/lib/doing/items.rb
CHANGED
|
@@ -102,7 +102,7 @@ module Doing
|
|
|
102
102
|
|
|
103
103
|
self[s_idx] = new_item
|
|
104
104
|
Doing.logger.count(:updated)
|
|
105
|
-
Doing.logger.info('Entry updated:', self[s_idx].title.
|
|
105
|
+
Doing.logger.info('Entry updated:', self[s_idx].title.trunc(60))
|
|
106
106
|
new_item
|
|
107
107
|
end
|
|
108
108
|
|
|
@@ -132,7 +132,7 @@ module Doing
|
|
|
132
132
|
@sections.each do |section|
|
|
133
133
|
out.push(section.original)
|
|
134
134
|
items = in_section(section.title).sort_by { |i| i.date }
|
|
135
|
-
items.reverse! if Doing.config.settings['doing_file_sort'].normalize_order ==
|
|
135
|
+
items.reverse! if Doing.config.settings['doing_file_sort'].normalize_order == :desc
|
|
136
136
|
items.each { |item| out.push(item.to_s)}
|
|
137
137
|
end
|
|
138
138
|
|
data/lib/doing/log_adapter.rb
CHANGED
|
@@ -277,17 +277,50 @@ module Doing
|
|
|
277
277
|
|
|
278
278
|
def log_benchmarks
|
|
279
279
|
if ENV['DOING_BENCHMARK']
|
|
280
|
+
|
|
280
281
|
output = []
|
|
281
|
-
@benchmarks
|
|
282
|
+
beginning = @benchmarks[:total][:start]
|
|
283
|
+
ending = @benchmarks[:total][:finish]
|
|
284
|
+
total = ending - beginning
|
|
285
|
+
factor = TTY::Screen.columns / total
|
|
286
|
+
|
|
287
|
+
cols = Array.new(TTY::Screen.columns)
|
|
288
|
+
|
|
289
|
+
colors = %w[bgred bggreen bgyellow bgblue bgmagenta bgcyan bgwhite boldbgred boldbggreen boldbgyellow boldbgblue boldbgwhite]
|
|
290
|
+
idx = 0
|
|
291
|
+
# @benchmarks.delete(:total)
|
|
292
|
+
|
|
293
|
+
@benchmarks.sort_by { |_, timers| [timers[:start], timers[:finish]] }.each do |k, timers|
|
|
282
294
|
if timers[:finish] && timers[:start]
|
|
283
|
-
|
|
295
|
+
color = colors[idx % colors.count]
|
|
296
|
+
fg = if idx < 7
|
|
297
|
+
Color.boldblack
|
|
298
|
+
else
|
|
299
|
+
Color.boldwhite
|
|
300
|
+
end
|
|
301
|
+
color = Color.send(color) + fg
|
|
302
|
+
|
|
303
|
+
start = ((timers[:start] - beginning) * factor).floor
|
|
304
|
+
finish = ((timers[:finish] - beginning) * factor).ceil
|
|
305
|
+
|
|
306
|
+
cols.fill("#{color}-", start..finish)
|
|
307
|
+
cols[start] = "#{color}|"
|
|
308
|
+
cols[finish] = "#{color}|"
|
|
309
|
+
output << "#{color}#{k}#{Color.default}: #{timers[:finish] - timers[:start]}"
|
|
284
310
|
else
|
|
285
311
|
output << "#{k}: error"
|
|
286
312
|
end
|
|
313
|
+
|
|
314
|
+
idx += 1
|
|
287
315
|
end
|
|
316
|
+
|
|
288
317
|
output.each do |msg|
|
|
289
318
|
$stdout.puts color_message(:debug, 'Benchmark:', msg)
|
|
290
319
|
end
|
|
320
|
+
|
|
321
|
+
$stdout.puts color_message(:debug, 'Benchmark:', "Total: #{total}")
|
|
322
|
+
|
|
323
|
+
$stdout.puts cols[0..TTY::Screen.columns-1].join + Color.reset
|
|
291
324
|
end
|
|
292
325
|
end
|
|
293
326
|
|