parent
056851463e
commit
d1355af66e
@ -123,7 +123,8 @@ def puts_columns items, cols = 4
|
||||
items.concat("\n") unless items.empty?
|
||||
|
||||
# determine the best width to display for different console sizes
|
||||
console_width = `/bin/stty size`.chomp.split(" ").last
|
||||
console_width = `/bin/stty size`.chomp.split(" ").last.to_i
|
||||
console_width = 80 if console_width <= 0
|
||||
longest = items.sort_by { |item| item.length }.last
|
||||
optimal_col_width = (console_width.to_f / (longest.length + 2).to_f).floor
|
||||
cols = optimal_col_width > 1 ? optimal_col_width : 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user