From 61caaa00c60f28efbc35d0f65de6a790208de24e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 7 May 2014 15:11:57 -0700 Subject: [PATCH] commands/docker-run: --help works [GH-3698] --- CHANGELOG.md | 1 + plugins/providers/docker/command/run.rb | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93fb856fe..34187fc34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ BUG FIXES: Vagrantfile. - core: Plugins that define config methods that collide with Ruby Kernel/Object - methods are merged properly. [GH-3670] + - commands/docker-run: `--help` works. [GH-3698] - commands/package: `--base` works without crashing for VirtualBox. - commands/reload: If `--provision` is specified, force provisioning. [GH-3657] - guests/redhat: Fix networking issues with CentOS. [GH-3649] diff --git a/plugins/providers/docker/command/run.rb b/plugins/providers/docker/command/run.rb index b130ca346..243973db5 100644 --- a/plugins/providers/docker/command/run.rb +++ b/plugins/providers/docker/command/run.rb @@ -29,18 +29,22 @@ module VagrantPlugins # Parse out the extra args to send to SSH, which is everything # after the "--" split_index = @argv.index("--") - if !split_index - @env.ui.error(I18n.t("docker_provider.run_command_required")) - return 1 + if split_index + command = @argv.drop(split_index + 1) + @argv = @argv.take(split_index) end - command = @argv.drop(split_index + 1) - @argv = @argv.take(split_index) - # Parse the options argv = parse_options(opts) return if !argv + # Show the error if we don't have "--" _after_ parse_options + # so that "-h" and "--help" work properly. + if !split_index + @env.ui.error(I18n.t("docker_provider.run_command_required")) + return 1 + end + target_opts = { provider: :docker } target_opts[:single_target] = options[:pty]