这是来自Trollop的输出示例,Ruby选项解析gem v0.0.1a
Options:
--input, -i <s>: Input file location (required)
--output, -o <s>: Output file destination (required)
--cores, -c <i>: Number of cores (default: 4)
--threshold, -t <f>: Threshold (default: 1.0)
--version, -v: Print version and exit
--help, -h: Show this message这是最好的解析器,因为它很小很整洁,但我真的不喜欢帮助消息的中心理由。我以前从来没有在我使用过的程序中看到过这种输出,我更喜欢它将选项放在左边,然后在第二列中把描述放在左边。有可能让它做到这一点吗?干杯
编辑:在最新版本的trollop中,这是用左对齐格式化的。太棒了!尽管在很短的一段时间内我确实习惯了中心的理由。谢谢
发布于 2013-10-16 23:56:08
不是的。Trollop现在的版本是2.0.0,帮助格式仍然是硬编码在代码中。如果你想增加输出格式,你可以修改trollop.rb。
https://stackoverflow.com/questions/14479716
复制相似问题