lib/hygroscope/cli.rb in hygroscope-1.1.2 vs lib/hygroscope/cli.rb in hygroscope-1.1.3
- old
+ new
@@ -91,11 +91,11 @@
# be prompted to change these if they were not in the paramset or the
# --ask option was passed.
e.describe.outputs.each do |o|
p.set(o.output_key, o.output_value) if t.parameters.keys.include?(o.output_key)
end
- end
+ end if options[:existing].is_a?(Array)
# Prompt for each missing parameter and save it in the paramset object
missing.each do |key|
# Do not prompt for keys prefixed with the "Hygroscope" reserved word.
# These parameters are populated internally without user input.
@@ -130,10 +130,11 @@
# Offer to save paramset if it was modified
# Filter out keys beginning with "Hygroscope" since they are not visible
# to the user and may be modified on each invocation.
unless missing.reject { |k| k =~ /^Hygroscope/ }.empty?
+ puts
if yes?('Save changes to paramset?')
unless options[:paramset]
p.name = ask('Paramset name', :cyan, default: options[:name])
end
p.save!
@@ -281,11 +282,12 @@
print_table header
puts
# Fancy acrobatics to fit output to terminal width. If the terminal
# window is too small, fallback to something appropriate for ~80 chars
- type_width = terminal_width < 80 ? 30 : terminal_width - 50
- output_width = terminal_width < 80 ? 54 : terminal_width - 31
+ term_width = %x(stty size 2>/dev/null).split[1].to_i || %x(tput cols 2>/dev/null).to_i
+ type_width = term_width < 80 ? 30 : term_width - 50
+ output_width = term_width < 80 ? 54 : term_width - 31
# Header row
puts set_color(sprintf(' %-28s %-*s %-18s ', 'Resource', type_width, 'Type', 'Status'), :white, :on_blue)
resources = stack.list_resources
resources.each do |r|