mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-08 23:18:10 -05:00
lib/downloader: Fix progress bar length on older CrOS terminals (#7482)
* Fix progress bar on older CrOS terminals * Make rubocop happy * Use new color code functions * Make rubocop happy * Align variables * Fix typo * Remove extra space
This commit is contained in:
@@ -13,8 +13,8 @@ class ProgressBar
|
||||
|
||||
# color scheme of progress bar, can be changed
|
||||
# see color.rb for more available colors
|
||||
@bar_front_color = :lightcyan
|
||||
@bar_bg_color = :gray
|
||||
@bar_front_color = %i[lightcyan no_bold]
|
||||
@bar_bg_color = %i[gray no_bold]
|
||||
|
||||
# all info blocks with space taken
|
||||
@info_before_bar = { downloaded_size_in_str: 20 }
|
||||
@@ -94,8 +94,8 @@ class ProgressBar
|
||||
end
|
||||
|
||||
# print progress bar with color code
|
||||
print ( @bar_char * completed_length).send(@bar_front_color),
|
||||
(@bar_char * uncompleted_length).send(@bar_bg_color)
|
||||
print (@bar_char * completed_length).send(*@bar_front_color),
|
||||
(@bar_char * uncompleted_length).send(*@bar_bg_color)
|
||||
|
||||
@info_after_bar.each_pair do |varName, width|
|
||||
printf ' %*.*s', width, width, instance_variable_get("@#{varName}")
|
||||
|
||||
Reference in New Issue
Block a user