Class: SysWatch::CLI
- Inherits:
-
Object
- Object
- SysWatch::CLI
- Defined in:
- lib/syswatch/cli.rb
Overview
Handles command line interface
Instance Method Summary collapse
-
#initialize(argv, env) ⇒ CLI
constructor
Initialize a new system watcher.
-
#parse_options!(args) ⇒ Object
Parse the command line options.
Constructor Details
Instance Method Details
#parse_options!(args) ⇒ Object
Parse the command line options
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/syswatch/cli.rb', line 19 def (args) @options = {} opts = ::OptionParser.new do |opts| opts. = "Usage: syswatch [options]\n\n Options:" opts.on("-f", "--foreground", "Do not daemonize, just run in foreground.") do |f| @options[:foreground] = f end opts.on("-v", "--verbose", "Be verbose, print out some messages.") do |v| @options[:verbose] = v end opts.on("-t", "--test", "Test notifications.") do |t| @options[:test] = t end opts.on("-c", "--config [FILE]", "Use a specific config file, instead of `#{SysWatch::DEFAULTS[:config]}`") do |config| @options[:config] = config end end opts.parse! args end |