Skip to content

Add dash if alias does not have dash#547

Open
tbpgr wants to merge 1 commit intorails:mainfrom
tbpgr:fix_option_alias_help
Open

Add dash if alias does not have dash#547
tbpgr wants to merge 1 commit intorails:mainfrom
tbpgr:fix_option_alias_help

Conversation

@tbpgr
Copy link

@tbpgr tbpgr commented Feb 17, 2017

Sample Code

alias o => option -o

require 'thor'
class SampleCLI < Thor
  desc "command usage", "command desc"
  option "opt", aliases: "o", type: :boolean
  def command(name)
    puts "opt on" if options['opt']
    puts "command #{name}"
  end
end

SampleCLI.start(ARGV)

Actual

Alias help does not have a dash.

$ ruby sample.rb command hoge
command hoge
$ ruby sample.rb command -o hoge
opt on
command hoge
$ ruby sample.rb command --opt hoge
opt on
command hoge
ruby sample.rb help command
Usage:
  sample.rb command usage

Options:
  o, [--opt], [--no-opt]

command desc

Expected

Alias help has a dash.

$ ruby sample.rb command hoge
command hoge
$ ruby sample.rb command -o hoge
opt on
command hoge
$ ruby sample.rb command --opt hoge
opt on
command hoge
ruby sample.rb help command
Usage:
  sample.rb command usage

Options:
  -o, [--opt], [--no-opt]

command desc

Related Issue

#159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant