Skip to content

Commit 274a8fd

Browse files
authored
Merge pull request #183 from opax/master
Fix some more crashes
2 parents 1e29c08 + 0c05072 commit 274a8fd

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

bin/commands/tags.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
elsif options[:line]
6161
puts tags.map { |t, _c| t }.to_tags.join(' ')
6262
else
63-
tags.each_key { |t| puts t }
63+
tags.each { |t, _| puts t }
6464
end
6565
end
6666
end

lib/doing/item/item.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def to_pretty(elements: %i[date title section])
105105
when :date
106106
output << format('%13s |', @date.relative_date).cyan
107107
when :section
108-
output << "#{magenta}(#{white(@section)}#{magenta})"
108+
output << "#{Color.magenta}(#{Color.white(@section)}#{Color.magenta})"
109109
when :title
110110
output << @title.white.highlight_tags('cyan')
111111
end

lib/doing/item/query.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ def highlight_search(search, distance: nil, negate: false, case_type: nil)
7878

7979
if search.rx? || matching == :fuzzy
8080
rx = search.to_rx(distance: distance, case_type: case_type)
81-
new_title = @title.gsub(rx) { |m| yellow(m) }
82-
new_note.add(@note.to_s.gsub(rx) { |m| yellow(m) })
81+
new_title = @title.gsub(rx) { |m| Color.yellow(m) }
82+
new_note.add(@note.to_s.gsub(rx) { |m| Color.yellow(m) })
8383
else
8484
query = search.strip.to_phrase_query
8585

@@ -89,8 +89,8 @@ def highlight_search(search, distance: nil, negate: false, case_type: nil)
8989
end
9090
query[:must].concat(query[:should]).each do |s|
9191
rx = Regexp.new(s.wildcard_to_rx, ignore_case(s, case_type))
92-
new_title = @title.gsub(rx) { |m| yellow(m) }
93-
new_note.add(@note.to_s.gsub(rx) { |m| yellow(m) })
92+
new_title = @title.gsub(rx) { |m| Color.yellow(m) }
93+
new_note.add(@note.to_s.gsub(rx) { |m| Color.yellow(m) })
9494
end
9595
end
9696

lib/doing/prompt/input.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def enter_text(prompt, default_response: '')
2020
$stdin.reopen('/dev/tty')
2121
return default_response if @default_answer
2222

23-
print "#{yellow(prompt).sub(/:?$/, ':')} #{reset}"
23+
print "#{Color.yellow(prompt).sub(/:?$/, ':')} #{Color.reset}"
2424
$stdin.gets.strip
2525
end
2626

@@ -50,7 +50,7 @@ def read_line(prompt: 'Enter text', completions: [], default_response: '')
5050
end
5151

5252
begin
53-
Readline.readline("#{yellow(prompt).sub(/:?$/, ':')} #{reset}", true).strip
53+
Readline.readline("#{Color.yellow(prompt).sub(/:?$/, ':')} #{Color.reset}", true).strip
5454
rescue Interrupt
5555
raise UserCancelled
5656
end
@@ -82,8 +82,8 @@ def read_lines(prompt: 'Enter text', completions: [], default_response: '')
8282
'(%<keycolor>sreturn twice%<textcolor>s)',
8383
'to end editing and save,',
8484
'%<keycolor>sCTRL-C%<textcolor>s to cancel%<reset>s'].join(' '),
85-
{ promptcolor: boldgreen, prompt: prompt.sub(/:?$/, ':'),
86-
textcolor: yellow, keycolor: boldwhite, reset: reset })
85+
{ promptcolor: Color.boldgreen, prompt: prompt.sub(/:?$/, ':'),
86+
textcolor: Color.yellow, keycolor: Color.boldwhite, reset: Color.reset })
8787

8888
res = []
8989

@@ -116,10 +116,10 @@ def request_lines(prompt: 'Enter text', default_response: '')
116116

117117
ask_note = []
118118
reader = TTY::Reader.new(interrupt: -> { raise Errors::UserCancelled }, track_history: false)
119-
puts "#{boldgreen(prompt.sub(/:?$/,
120-
':'))} #{yellow('Hit return for a new line, ')}#{boldwhite('enter a blank line (')}#{boldyellow('return twice')}#{boldwhite(') to end editing')}"
119+
puts "#{Color.boldgreen(prompt.sub(/:?$/,
120+
':'))} #{Color.yellow('Hit return for a new line, ')}#{Color.boldwhite('enter a blank line (')}#{Color.boldyellow('return twice')}#{Color.boldwhite(') to end editing')}"
121121
loop do
122-
res = reader.read_line(green('> '))
122+
res = reader.read_line(Color.green('> '))
123123
break if res.strip.empty?
124124

125125
ask_note.push(res)

lib/doing/wwid/interactive.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ def verify_duration(date, finish_date, title: nil)
365365
elapsed = finish_date - date
366366

367367
if max_elapsed.positive? && (elapsed > max_elapsed)
368-
puts boldwhite(title) if title
368+
puts Color.boldwhite(title) if title
369369
human = elapsed.time_string(format: :natural)
370370
res = Prompt.yn(Color.yellow("Did this entry actually take #{human}"), default_response: true)
371371
unless res

lib/doing/wwid/modify.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def stop_start(target_tag, opt)
399399
##
400400
def delete_items(items, force: false)
401401
items.slice(0, 5).each { |i| puts i.to_pretty } unless force
402-
puts softpurple("+ #{items.size - 5} additional #{'item'.to_p(items.size - 5)}") if items.size > 5 && !force
402+
puts Color.softpurple("+ #{items.size - 5} additional #{'item'.to_p(items.size - 5)}") if items.size > 5 && !force
403403

404404
res = force ? true : Prompt.yn("Delete #{items.size} #{'item'.to_p(items.size)}?", default_response: 'y')
405405
return unless res

0 commit comments

Comments
 (0)