bin/screwcap in screwcap-0.3.1 vs bin/screwcap in screwcap-0.3.2

- old
+ new

@@ -8,12 +8,16 @@ p = Trollop::Parser.new do opt :silent, "Be silent" opt :nocolor, "Do not color output" opt :debug, "Turn on debugger. Will print full stacktrace if an exeception was raised" opt :help, "Show this message" + opt :tasks, "Display available tasks in recipe file" + version <<-EOF + Screwcap #{Screwcap::VERSION} by Grant Ammons (grant@pipelinedeals.com) + More info at http://gammons.github.com/screwcap + EOF banner <<-EOF - Usage: screwcap [options] file task_name [[task_name2], [task_name3], ...] Example: screwcap config/deploy.rb deploy_to_staging EOF end @@ -21,9 +25,20 @@ opts = p.parse ARGV if opts[:debug] == true require 'ruby-debug' Debugger.start end + + if opts[:tasks] == true + recipe_file = ARGV.shift + deployer = Deployer.new(opts.merge(:recipe_file => recipe_file)) + $stdout << "Tasks Available:\n" if deployer.__tasks.size > 0 + deployer.__tasks.map {|t| t.__name }.each {|name| $stdout << " #{name}\n" } + $stdout << "Sequences Available:\n" if deployer.__sequences.size > 0 + deployer.__sequences.map {|t| t.__name }.each {|name| $stdout << " #{name}\n" } + exit + end + raise Trollop::HelpNeeded if ARGV.size < 2 recipe_file = ARGV.shift begin Deployer.new(opts.merge(:recipe_file => recipe_file)).run! ARGV.map {|a| a.to_sym } rescue Exception => e