当打印其帮助输出时,gem似乎总是按照字母顺序排列定义的命令。例如:Thor CLI:在帮助输出中设置命令的自定义顺序
#!/usr/bin/env ruby
require "thor"
class MyCLI < Thor
desc "z", "this should go first"
def z; end
desc "a", "this should go second"
def a; end
end
MyCLI.start(ARGV)
保存该脚本thor-test
并调用它不带参数给出了这样的输出:
Commands:
thor-test a # this should go second
thor-test help [COMMAND] # Describe available commands or one specific command
thor-test z # this should go first
问:我怎么能告诉托尔以不同的方式订购条目?
你的猴子补丁是有点太邪恶了我;)我张贴了自己的解决方案,并接受了现在。但是非常感谢您将我指向源代码中的正确位置。 – thutt