class At_email::Config::Cmd_Opt_Parser
Constants
- CODES
- CODE_ALIASES
Attributes
config_file[R]
quiet[R]
silent[R]
verbose[R]
Public Class Methods
new(args)
click to toggle source
# File lib/at_email/config/cmd_opt_parser.rb, line 17 def initialize(args) @silent = false @quiet = false @verbose = false opt_parser = OptionParser.new do |opts| opts.banner = "Usage: #{$PROGRAM_NAME} [options]" opts.separator "" opts.separator "Options:" opts.on("-c [CONFIG FILE]", "--config-file [CONFIG FILE]", String, "Config File (JSON)") do |config_file| @config_file = config_file end opts.on("-s", "--silent", "Run silently") do @silent = true end opts.on("-q", "--quiet", "Run quietly") do @quiet = true if @silent @silent = false end end opts.on("-v", "--verbose", "Run verbosely") do @verbose = true if @quiet @quiet = false end if @silent @silent = false end end opts.on_tail("-h", "--help", "Show this message") do puts opts exit end opts.on_tail("--version", "Show version") do puts At_email::VERSION exit end end opt_parser.parse!(args) end