Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/commands/tags.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
elsif options[:line]
puts tags.map { |t, _c| t }.to_tags.join(' ')
else
tags.each_key { |t| puts t }
tags.each { |t, _| puts t }
end
end
end
2 changes: 1 addition & 1 deletion lib/doing/item/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def to_pretty(elements: %i[date title section])
when :date
output << format('%13s |', @date.relative_date).cyan
when :section
output << "#{magenta}(#{white(@section)}#{magenta})"
output << "#{Color.magenta}(#{Color.white(@section)}#{Color.magenta})"
when :title
output << @title.white.highlight_tags('cyan')
end
Expand Down
8 changes: 4 additions & 4 deletions lib/doing/item/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ def highlight_search(search, distance: nil, negate: false, case_type: nil)

if search.rx? || matching == :fuzzy
rx = search.to_rx(distance: distance, case_type: case_type)
new_title = @title.gsub(rx) { |m| yellow(m) }
new_note.add(@note.to_s.gsub(rx) { |m| yellow(m) })
new_title = @title.gsub(rx) { |m| Color.yellow(m) }
new_note.add(@note.to_s.gsub(rx) { |m| Color.yellow(m) })
else
query = search.strip.to_phrase_query

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

Expand Down
14 changes: 7 additions & 7 deletions lib/doing/prompt/input.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def enter_text(prompt, default_response: '')
$stdin.reopen('/dev/tty')
return default_response if @default_answer

print "#{yellow(prompt).sub(/:?$/, ':')} #{reset}"
print "#{Color.yellow(prompt).sub(/:?$/, ':')} #{Color.reset}"
$stdin.gets.strip
end

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

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

res = []

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

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

ask_note.push(res)
Expand Down
2 changes: 1 addition & 1 deletion lib/doing/wwid/interactive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ def verify_duration(date, finish_date, title: nil)
elapsed = finish_date - date

if max_elapsed.positive? && (elapsed > max_elapsed)
puts boldwhite(title) if title
puts Color.boldwhite(title) if title
human = elapsed.time_string(format: :natural)
res = Prompt.yn(Color.yellow("Did this entry actually take #{human}"), default_response: true)
unless res
Expand Down
2 changes: 1 addition & 1 deletion lib/doing/wwid/modify.rb
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ def stop_start(target_tag, opt)
##
def delete_items(items, force: false)
items.slice(0, 5).each { |i| puts i.to_pretty } unless force
puts softpurple("+ #{items.size - 5} additional #{'item'.to_p(items.size - 5)}") if items.size > 5 && !force
puts Color.softpurple("+ #{items.size - 5} additional #{'item'.to_p(items.size - 5)}") if items.size > 5 && !force

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