ruby - Ruby gem Trollop 中的输出

标签 ruby parsing rubygems

这是 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/

相关文章:

ruby-on-rails - 我应该如何将 bundle install --standalone 与 Rails 应用程序一起使用?

ruby-on-rails - rvm 与 sqlite3 冲突

ruby-on-rails - 为什么 Ruby 版本更新需要安装 bundler?

ruby-on-rails - Rails : making link_to method send remote request as JSON type, 不是 JS 类型

ruby - 在 GMAIL 上使用 IMAP 获取附件的大小

java - 将逗号分隔的字符串拆分为多个新字符串

c++ - 如何在 linux 终端中处理带有负号 (-) 的 C++ 命令行参数?

ruby - 如何访问属性

javascript - Ajax 调用 Rails 返回缺少模板

python - 给定一个字符串,如何返回 json 路径?