我有一个使用多种方法的 Thor 脚本
类更新<雷神 desc "do_it", "一个简单的任务" def do_it 把 i_did_it 结尾 #这里没有描述!!! 定义 i_did_it “我做到了” 结尾 结尾
这可能吗?如果没有明确的任务,就无法正确构建任务列表。
谢谢,
蒂姆
我有一个使用多种方法的 Thor 脚本
类更新<雷神 desc "do_it", "一个简单的任务" def do_it 把 i_did_it 结尾 #这里没有描述!!! 定义 i_did_it “我做到了” 结尾 结尾
这可能吗?如果没有明确的任务,就无法正确构建任务列表。
谢谢,
蒂姆
我可以为此使用 no_tasks 块。
类更新<雷神 desc "do_it", "一个简单的任务" def do_it 把 i_did_it 结尾 #这里没有描述!!! no_tasks 做 定义 i_did_it “我做到了” 结尾 结尾 结尾
我在 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
}