lib/guignol/commands/kill.rb in guignol-0.3.4 vs lib/guignol/commands/kill.rb in guignol-0.3.5

- old
+ new

@@ -2,10 +2,11 @@ require 'guignol/commands/base' require 'guignol/models/instance' Guignol::Shell.class_eval do desc 'kill PATTERNS', 'Terminate all instances matching PATTERNS' + add_force_option def kill(*patterns) if patterns.empty? raise Thor::Error.new('You must specify at least one PATTERN.') end Guignol::Commands::Kill.new(patterns).run @@ -14,11 +15,12 @@ module Guignol::Commands class Kill < Base - def before_run(configs) + def before_run(configs, options = {}) return true if configs.empty? + return true if options[:force] names = configs.keys.join(", ") shell.yes? "Are you sure you want to destroy servers #{names}? [y/N]", :cyan end def run_on_server(instance, options = {})