當打印其幫助輸出時,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