【发布时间】:2011-06-28 23:05:26
【问题描述】:
在使用 thor 时,我习惯于编写这样的代码,
desc "import", "Import diamonds from the south."
method_option :num_diamonds, :type => :numeric, :default => nil
def import
diamond_importer = DiamondImporter.new
diamond_importer.update_maps
diamond_importer.process_diamonds(options)
end
当我运行不带参数或使用 -T 的 diamond_importer 命令行工具时,我得到一个任务描述列表,如“import”,但没有描述“num_diamonds”等选项或其用法。
如何添加此类使用详情以便显示?
谢谢!
【问题讨论】:
标签: ruby command-line thor