lib/chef/knife/joyent_server_pricing.rb in knife-joyent-0.4.9 vs lib/chef/knife/joyent_server_pricing.rb in knife-joyent-0.4.10
- old
+ new
@@ -7,29 +7,35 @@
include Knife::JoyentBase
option :reserve_pricing,
:short => '-r <file>',
:long => '--reserve-pricing <file>',
- :description => 'Apply reserve discounts from a YAML config (see joyent-cloud-pricing gem)',
+ :description => 'Apply custom pricing from a YAML file (see: joyent-cloud-pricing gem)',
:proc => Proc.new { |key| Chef::Config[:knife][:reserve_pricing] = key }
option :show_zones,
:short => '-z',
- :long => '--show-zones',
- :description => 'Print list of on-demand zones sorted by price',
+ :long => '--show-zone-flavors',
+ :description => 'Print aggregated list of zone flavors sorted by price',
:proc => Proc.new { |key| Chef::Config[:knife][:show_zones] = key }
- banner 'knife joyent server pricing [-r <reserve-pricing.yml> ] [ -z ] '
+ option :no_color,
+ :long => '--no-color',
+ :description => 'Disable color when printing',
+ :proc => Proc.new { |key| Chef::Config[:knife][:no_color] = true }
+ banner 'knife joyent server pricing [-r <custom-pricing.yml>] [-z] [--no-color]'
+
def run
flavors = []
self.connection.servers.each do |s|
flavor = s.package || 'unknown'
flavors << flavor
end
- reporter = Joyent::Cloud::Pricing::Reporter.new(Chef::Config[:knife][:reserve_pricing], flavors)
- reporter.print_zone_list = Chef::Config[:knife][:show_zones]
- puts reporter.render
+ config = Chef::Config[:knife]
+ reporter = Joyent::Cloud::Pricing::Reporter.new(config[:reserve_pricing], flavors)
+ reporter.print_zone_list = config[:show_zones]
+ puts reporter.render(:disable_color => config[:no_color])
rescue => e
output_error(e)
end
end
end