lib/inspec/cli.rb in inspec-3.0.12 vs lib/inspec/cli.rb in inspec-3.0.25

- old
+ new

@@ -291,9 +291,20 @@ return :rspec_run, runner.run_tests # rubocop:disable Style/RedundantReturn end end begin + # Handle help commands + # This allows you to use any of the normal help commands after the normal args. + help_commands = ['-h', '--help', 'help'] + (help_commands & ARGV).each do |cmd| + # move the help argument to one place behind the end for Thor to digest + if ARGV.size > 1 + match = ARGV.delete(cmd) + ARGV.insert(-2, match) + end + end + # Load v2 plugins v2_loader = Inspec::Plugin::V2::Loader.new v2_loader.load_all v2_loader.exit_on_load_error v2_loader.activate_mentioned_cli_plugins