这是 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 中,它现在被格式化为左对齐。这很棒!尽管我在短时间内确实习惯了中心对齐。谢谢
最佳答案
没有。 Trollop 现在是 2.0.0 版,帮助格式仍然硬编码在代码中。你可以破解 trollop.rb如果您希望增加输出格式。
关于ruby - Ruby gem Trollop 中的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14479716/