简体   繁体   中英

How can I get “thor list” to list methods in ruby class

I have problems listing my tasks in thor, even with the simplest program:

class Mytest < Thor
  desc "Hello world", "Puts 'hello world' on the console"
  def hello
    puts "Hello world"
  end
end

Here is the console output when i run thor list

$ thor list
mytest
------
thor mytest:world  # Puts 'hello world' on the console

As you can see the "hello" method name is omitted from the output. Can you help me out please?

Thank you,
Paul

Just change the 'desc' line to:

desc "hello", "Puts 'hello world' on the console"

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM