lib/bolt/bolt_option_parser.rb in bolt-1.16.0 vs lib/bolt/bolt_option_parser.rb in bolt-1.17.0

- old
+ new

@@ -147,10 +147,16 @@ @options[:nodes] << get_arg_input(nodes) end.extend(SwitchHider) @query = define('-q', '--query QUERY', 'Query PuppetDB to determine the targets') do |query| @options[:query] = query end.extend(SwitchHider) + @rerun = define('--rerun FILTER', 'Retry on nodes from the last run', + "'all' all nodes that were part of the last run.", + "'failure' nodes that failed in the last run.", + "'success' nodes that succeeded in the last run.") do |rerun| + @options[:rerun] = rerun + end.extend(SwitchHider) define('--noop', 'Execute a task that supports it in noop mode') do |_| @options[:noop] = true end define('--description DESCRIPTION', 'Description to use for the job') do |description| @@ -236,10 +242,13 @@ if ENV.include?(Bolt::Inventory::ENVIRONMENT_VAR) raise Bolt::CLIError, "Cannot pass inventory file when #{Bolt::Inventory::ENVIRONMENT_VAR} is set" end @options[:inventoryfile] = File.expand_path(path) end + define('--[no-]save-rerun', 'Whether to update the rerun file after this command.') do |save| + @options[:'save-rerun'] = save + end separator 'Transports:' define('--transport TRANSPORT', TRANSPORTS.keys.map(&:to_s), "Specify a default transport: #{TRANSPORTS.keys.join(', ')}") do |t| @options[:transport] = t @@ -280,29 +289,29 @@ update end def update - # show the --nodes and --query switches by default - @nodes.hide = @query.hide = false + # show the --nodes, --query, and --rerun switches by default + @nodes.hide = @query.hide = @rerun.hide = false # Don't show the --execute switch except for `apply` @execute.hide = true # Update the banner according to the subcommand self.banner = case @options[:subcommand] when 'plan' - # don't show the --nodes and --query switches in the plan help - @nodes.hide = @query.hide = true PLAN_HELP when 'command' COMMAND_HELP when 'script' SCRIPT_HELP when 'task' TASK_HELP when 'file' FILE_HELP when 'puppetfile' + # Don't show targeting options for puppetfile + @nodes.hide = @query.hide = @rerun.hide = true PUPPETFILE_HELP when 'apply' @execute.hide = false APPLY_HELP else