Skip to content

Commit

Permalink
Add alias support for both control and control-url options in cli
Browse files Browse the repository at this point in the history
- puma#1416 introduced a bug in pumactl
  the puma cli does not respond to `control-cli` option. On puma it is called `control`
- this commit puma@a8f54f7
  was correct, but it looked like a typo since the names of the options are not consistent across versions
- the best option for fixing this seems to be to support both options in the cli
- we don't want to stop supporting `control` in the cli for backwards-compatibility

- should pumactl be extended to support `control`? we don't need to worry about
  backwards compatibility for this one, but it could cause some confusion

-[] test
  • Loading branch information
jxa committed Dec 15, 2017
1 parent 5a6f3f2 commit 5b6b53d
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions lib/puma/cli.rb
Expand Up @@ -83,6 +83,14 @@ def unsupported(str)
raise UnsupportedOption
end

def configure_control_url(command_line_arg)
if command_line_arg
@control_url = command_line_arg
elsif Puma.jruby?
unsupported "No default url available on JRuby"
end
end

# Build the OptionParser object to handle the available options.
#

Expand All @@ -97,13 +105,15 @@ def setup_options
file_config.load arg
end

o.on "--control URL", "The bind url to use for the control server",
"Use 'auto' to use temp unix server" do |arg|
if arg
@control_url = arg
elsif Puma.jruby?
unsupported "No default url available on JRuby"
end
control_url_desc = "The bind url to use for the control server. Use 'auto' to use temp unix server"

o.on "--control-url URL", control_url_desc do |arg|
configure_control_url(arg)
end

# alias --control-url for backwards-compatibility
o.on "--control URL", control_url_desc do |arg|
configure_control_url(arg)
end

o.on "--control-token TOKEN",
Expand Down

0 comments on commit 5b6b53d

Please sign in to comment.