Skip to content

Error when passing stealth generate without arguments #171

Description

@luizcarvalho

Hello friends,

I tried use stealth generate expecting receive a message to help me use command, but I received this error.

Traceback (most recent call last):
	10: from /home/desenvolvimento/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `<main>'
	 9: from /home/desenvolvimento/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `eval'
	 8: from /home/desenvolvimento/.rvm/gems/ruby-2.5.3/bin/stealth:23:in `<main>'
	 7: from /home/desenvolvimento/.rvm/gems/ruby-2.5.3/bin/stealth:23:in `load'
	 6: from /home/desenvolvimento/dev/51/stealth-example-1_1_6/vendor/gems/stealth/bin/stealth:5:in `<top (required)>'
	 5: from /home/desenvolvimento/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
	 4: from /home/desenvolvimento/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
	 3: from /home/desenvolvimento/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
	 2: from /home/desenvolvimento/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor/command.rb:20:in `run'
	 1: from /home/desenvolvimento/.rvm/gems/ruby-2.5.3/gems/thor-0.20.3/lib/thor/command.rb:34:in `rescue in run'
/home/desenvolvimento/dev/51/stealth-example-1_1_6/vendor/gems/stealth/lib/stealth/cli_base.rb:19:in `handle_argument_error': can't modify frozen String (FrozenError)

I'm using ruby 2.5.3 (tried 2.5.1 too) and Stealth 1.1.6

I made a little modification in cli_base.rb file to solve this, but I do not know if it is the best solution.

    def handle_argument_error(command, error, args, arity)
      name = [(namespace == 'stealth:cli' ? nil : namespace), command.name].compact.join(" ")

      msg = "ERROR: \"#{basename} #{name}\" was called with "

      msg = "#{msg}no arguments"               if     args.empty?
      msg = "#{msg}arguments #{args.inspect}"  unless args.empty?
      msg = "#{msg}\nUsage: #{banner(command).inspect}"

      raise Thor::InvocationError, msg
    end

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions