From 4b1f0daefbb8e24a619f8dddc1d229b65cac879b Mon Sep 17 00:00:00 2001 From: Cameron Johnston Date: Thu, 4 Dec 2014 18:19:07 -0700 Subject: [PATCH] add option to skip confirmation of pruning action --- lib/fog-prune/options.rb | 7 +++++++ lib/fog-prune/prune.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/fog-prune/options.rb b/lib/fog-prune/options.rb index 3df8c35..f452419 100644 --- a/lib/fog-prune/options.rb +++ b/lib/fog-prune/options.rb @@ -86,6 +86,13 @@ class Options :boolean => true, :default => false, :description => 'Print action and exit' + ) + option(:skip_confirmation, + :short => '-y', + :long => '--skip-confirmation', + :boolean => true, + :default => false, + :description => 'Prune nodes without prompting for confirmation' ) option(:stale_nodes, :short => '-S', diff --git a/lib/fog-prune/prune.rb b/lib/fog-prune/prune.rb index e1fb135..9924146 100644 --- a/lib/fog-prune/prune.rb +++ b/lib/fog-prune/prune.rb @@ -63,7 +63,7 @@ def prune! ui.warn "Nodes to prune: #{nodes_to_prune.size}" debug "#{nodes_to_prune.map(&:name).sort.join(', ')}" unless(Config[:print_only]) - ui.confirm('Destroy these nodes') + ui.confirm('Destroy these nodes') unless Config[:skip_confirmation] nodes_to_prune.each do |node| prune_node(node) end