commander-rb / commander

The complete solution for Ruby command-line executables
MIT License
823 stars 74 forks source link

Broken compact help formatter #12

Closed KrauseFx closed 9 years ago

KrauseFx commented 9 years ago

With the most recent version, the help formatter is broken, resulting the following stack trace:

./bin/fastlane --help
(erb):2:in `get_binding': undefined method `size' for nil:NilClass (NoMethodError)
        from /Users/felixkrause/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/erb.rb:849:in `eval'
        from /Users/felixkrause/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/erb.rb:849:in `result'
        from /Users/felixkrause/.rvm/gems/ruby-2.0.0-p481@global/gems/commander-4.3.3/lib/commander/help_formatters/terminal.rb:7:in `render'
        from /Users/felixkrause/.rvm/gems/ruby-2.0.0-p481@global/gems/commander-4.3.3/lib/commander/runner.rb:302:in `block (2 levels) in create_default_commands'
        from /Users/felixkrause/.rvm/gems/ruby-2.0.0-p481@global/gems/commander-4.3.3/lib/commander/command.rb:178:in `call'
        from /Users/felixkrause/.rvm/gems/ruby-2.0.0-p481@global/gems/commander-4.3.3/lib/commander/command.rb:178:in `call'
        from /Users/felixkrause/.rvm/gems/ruby-2.0.0-p481@global/gems/commander-4.3.3/lib/commander/command.rb:153:in `run'
        from /Users/felixkrause/.rvm/gems/ruby-2.0.0-p481@global/gems/commander-4.3.3/lib/commander/runner.rb:57:in `block in run!'
        from /Users/felixkrause/.rvm/gems/ruby-2.0.0-p481@global/gems/commander-4.3.3/lib/commander/runner.rb:382:in `block in global_option_proc'
        from /Users/felixkrause/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/optparse.rb:1364:in `call'
        from /Users/felixkrause/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/optparse.rb:1364:in `block in parse_in_order'
        from /Users/felixkrause/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/optparse.rb:1351:in `catch'
        from /Users/felixkrause/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/optparse.rb:1351:in `parse_in_order'
        from /Users/felixkrause/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/optparse.rb:1345:in `order!'
        from /Users/felixkrause/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/optparse.rb:1437:in `permute!'
        from /Users/felixkrause/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/optparse.rb:1459:in `parse!'
        from /Users/felixkrause/.rvm/gems/ruby-2.0.0-p481@global/gems/commander-4.3.3/lib/commander/runner.rb:363:in `parse_global_options'
        from /Users/felixkrause/.rvm/gems/ruby-2.0.0-p481@global/gems/commander-4.3.3/lib/commander/runner.rb:65:in `run!'
        from /Users/felixkrause/.rvm/gems/ruby-2.0.0-p481@global/gems/commander-4.3.3/lib/commander/delegates.rb:15:in `run!'
        from ./bin/fastlane:118:in `run'
        from ./bin/fastlane:124:in `<main>'

This can be reproduced using the fastlane gem. When I remove the help formatter specification it's working just fine.

KrauseFx commented 9 years ago

In the mean time, I disabled the compact formatter: https://github.com/KrauseFx/fastlane/blob/master/bin/fastlane#L20

ggilder commented 9 years ago

Thanks for catching this. Good incentive to add a spec for the compact formatter so that this kind of regression doesn't happen again. :wink:

I've just merged a fix and released version 4.3.4.

KrauseFx commented 9 years ago

Thank you @ggilder for pushing a fix so quickly, it's working now! :+1: :rocket: