【发布时间】:2011-11-01 00:31:21
【问题描述】:
我有一个使用多种方法的 Thor 脚本
类更新这可能吗?如果没有明确的任务,就无法正确构建任务列表。
谢谢,
提姆
【问题讨论】:
-
我不明白为什么这不可能...您遇到了问题吗?
标签: ruby-on-rails ruby thor
我有一个使用多种方法的 Thor 脚本
类更新这可能吗?如果没有明确的任务,就无法正确构建任务列表。
谢谢,
提姆
【问题讨论】:
标签: ruby-on-rails ruby thor
我可以为此使用 no_tasks 块。
类更新【讨论】:
我在 2018 年尝试过,no_tasks 对我不起作用(现在可能已替换为以下内容):
根据雷神的建议
Call desc if you want this method to be available as command or declare it inside a no_commands{} block.
因此,您可以将不想在 CLI 中显示的方法放在 no_commands 块中,如下所示:
# no_commands is used to not show this as a command in our CLI gem
no_commands {
# no desc here !!!
# put here the methods that you don't want to show in your CLI
def i_did_it
"I did it"
end
}
【讨论】: