Class: Telly::ArgParser
- Inherits:
-
Object
- Object
- Telly::ArgParser
- Defined in:
- lib/telly/arg_parser.rb
Constant Summary collapse
- VERSION_STRING =
" __o_____ ()/O\\___() `-\\\\---' TELLY %s! __\\/__ | .... | | .... | ------ "
Class Method Summary collapse
-
.parse_opts ⇒ Void
Parses the command line options.
Class Method Details
.parse_opts ⇒ Void
Parses the command line options
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/telly/arg_parser.rb', line 20 def self.parse_opts = {} optparse = OptionParser.new do|parser| = { testrun_id: nil, junit_file: nil, } parser.on( '-t', '--testrun-id TESTRUN_ID', 'The testrun id' ) do |testrun_id| [:testrun_id] = testrun_id end parser.on( '-j', '--junit-folder JUNIT_FILE', 'Beaker junit file' ) do |junit_file| [:junit_file] = junit_file end parser.on( '-d', '--dry-run', 'Run without API connection to TestRail' ) do [:dry_run] = true end parser.on( '-h', '--help', 'Display this screen' ) do puts parser exit end parser.on( '-v', '--version', 'Report the current version number' ) do puts VERSION_STRING % Telly::Version::STRING exit end parser.parse! if not [:testrun_id] or not [:junit_file] puts "Error: Missing option(s)" puts parser exit end end end |