Module: Jira::Auto::Tool::CommonOptions
- Defined in:
- lib/jira/auto/tool/common_options.rb
Constant Summary collapse
- DISPLAY_HELP_OPTION =
"--help"
Class Method Summary collapse
- .add(tool, parser) ⇒ Object
- .add_help_banner_and_options(parser) ⇒ Object
- .add_version_options(parser, tool) ⇒ Object
Class Method Details
.add(tool, parser) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/jira/auto/tool/common_options.rb', line 11 def self.add(tool, parser) ::ARGV << DISPLAY_HELP_OPTION if ARGV.empty? parser.section_header "Common" (parser) (parser, tool) end |
.add_help_banner_and_options(parser) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/jira/auto/tool/common_options.rb', line 20 def self.(parser) parser. = " Usage: \#{File.basename($PROGRAM_NAME)} [options]*\n EOBANNER\n\n parser.on(\"-h\", DISPLAY_HELP_OPTION, \"Print this help\") do\n Kernel.puts parser\n Kernel.exit 1\n end\nend\n" |
.add_version_options(parser, tool) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/jira/auto/tool/common_options.rb', line 31 def self.(parser, tool) parser.on("-v", "--version", "Print the version") do Kernel.puts tool.class::VERSION Kernel.exit 1 end end |