From a98ec9dbc16449359b9617ddc0f8f150a79c4a6b Mon Sep 17 00:00:00 2001 From: "O. Pax" Date: Fri, 28 Nov 2025 14:09:11 +0100 Subject: [PATCH 1/2] Fix more color references --- lib/doing/item/item.rb | 2 +- lib/doing/item/query.rb | 8 ++++---- lib/doing/prompt/input.rb | 14 +++++++------- lib/doing/wwid/interactive.rb | 2 +- lib/doing/wwid/modify.rb | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/doing/item/item.rb b/lib/doing/item/item.rb index 97182f47..9129e664 100644 --- a/lib/doing/item/item.rb +++ b/lib/doing/item/item.rb @@ -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 diff --git a/lib/doing/item/query.rb b/lib/doing/item/query.rb index b3df0fb9..d626663b 100644 --- a/lib/doing/item/query.rb +++ b/lib/doing/item/query.rb @@ -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 @@ -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 diff --git a/lib/doing/prompt/input.rb b/lib/doing/prompt/input.rb index d084bc2e..13c13d51 100644 --- a/lib/doing/prompt/input.rb +++ b/lib/doing/prompt/input.rb @@ -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 @@ -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 @@ -82,8 +82,8 @@ def read_lines(prompt: 'Enter text', completions: [], default_response: '') '(%sreturn twice%s)', 'to end editing and save,', '%sCTRL-C%s to cancel%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 = [] @@ -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) diff --git a/lib/doing/wwid/interactive.rb b/lib/doing/wwid/interactive.rb index c70e89f6..9317ae06 100644 --- a/lib/doing/wwid/interactive.rb +++ b/lib/doing/wwid/interactive.rb @@ -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 diff --git a/lib/doing/wwid/modify.rb b/lib/doing/wwid/modify.rb index ec9fdbe1..7c57661b 100644 --- a/lib/doing/wwid/modify.rb +++ b/lib/doing/wwid/modify.rb @@ -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 From 0c05072f8fd2914bcb80718e587e7255bc0e4402 Mon Sep 17 00:00:00 2001 From: "O. Pax" Date: Fri, 28 Nov 2025 14:10:07 +0100 Subject: [PATCH 2/2] Fix crash in `doing tags` tags is an array, not a map in this context. --- bin/commands/tags.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/commands/tags.rb b/bin/commands/tags.rb index 1e14b973..63ebd6f0 100644 --- a/bin/commands/tags.rb +++ b/bin/commands/tags.rb @@ -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