Class: Islo::CLI
- Inherits:
-
Object
- Object
- Islo::CLI
- Defined in:
- lib/islo/cli.rb
Overview
Handle and run the command line interface
Constant Summary collapse
- NAME =
File.basename($PROGRAM_NAME)
- RC =
See sysexits(3)
{ ok: 0, error: 1, usage: 64, data: 65, noinput: 66, nouser: 67, nohost: 68, unavailable: 69, software: 70, oserr: 71, osfile: 72, cantcreat: 73, ioerr: 74, tempfail: 75, protocol: 76, noperm: 77, config: 78 }
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
Class Method Summary collapse
-
.start ⇒ Object
Shortcut for Islo::CLI.new.start.
Instance Method Summary collapse
-
#initialize(args = ARGV) ⇒ CLI
constructor
A new instance of CLI.
- #opts ⇒ Object
-
#start ⇒ Object
Start execution based on options.
Constructor Details
#initialize(args = ARGV) ⇒ CLI
Returns a new instance of CLI.
40 41 42 43 44 45 46 |
# File 'lib/islo/cli.rb', line 40 def initialize(args = ARGV) @args, @opts = parse(args) rescue Slop::InvalidOptionError => e die(:usage, e.) rescue Slop::MissingArgumentError => e die(:usage, e.) end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
34 35 36 |
# File 'lib/islo/cli.rb', line 34 def args @args end |
Class Method Details
.start ⇒ Object
Shortcut for Islo::CLI.new.start
30 31 32 |
# File 'lib/islo/cli.rb', line 30 def self.start new.start end |
Instance Method Details
#opts ⇒ Object
36 37 38 |
# File 'lib/islo/cli.rb', line 36 def opts @opts.to_hash end |