hellostealth / stealth

An open source Ruby framework for text and voice chatbots. 🤖

Home Page:https://hellostealth.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when passing stealth generate without arguments

luizcarvalho opened this issue · comments

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

When I try use another wrong command stealth generate product, the error message is, maybe, doesn't help much.

ERROR: "stealth generate" was called with arguments ["product"]
Usage: "stealth generate"

I can help with this.