Method: Retrospec::Puppet::Generators::TaskGenerator.run_cli
- Defined in:
- lib/retrospec/plugins/v1/plugin/generators/task_generator.rb
.run_cli(global_opts, args = ARGV) ⇒ Object
used to display subcommand options to the cli the global options are passed in for your usage optimist.rubyforge.org all options here are available in the config passed into config object returns the parameters
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/retrospec/plugins/v1/plugin/generators/task_generator.rb', line 85 def self.run_cli(global_opts, args = ARGV) task_types = %w(bash generic ruby python node powershell) task_type = global_opts['plugins::puppet::default_task_type'] || 'bash' sub_command_opts = Optimist.(args) do <<-EOS Creates a new puppet bolt task for your module Example: retrospec puppet new_task -n reboot -p "name, ttl, message" EOS opt :name, 'The name of the task you wish to create', :type => :string, :required => true, :short => '-n' opt :task_params, 'The task parameter names separated by commas', :short => '-p', :type => :string, :required => false, default: 'name' opt :task_type, "The task type of the task (#{task_types.join(', ')})", :type => :string, :required => false, :short => '-t', :default => task_type end unless sub_command_opts[:name] Optimist.educate exit 1 end plugin_data = global_opts.merge(sub_command_opts) plugin_data end |