Class: Vop::Shell
- Inherits:
-
Object
- Object
- Vop::Shell
- Defined in:
- lib/vop/shell.rb
Constant Summary collapse
- USAGE =
"virtualop\n\nUsage:\n vop [options]\n\nOptions:\n -h --help show this help screen\n -v --verbose enable debug output\n -e --execute=<command> to run a command directly\n\n"
Instance Attribute Summary collapse
-
#op ⇒ Object
readonly
Returns the value of attribute op.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
- #execute(string) ⇒ Object
-
#initialize(vop = nil, options = {}) ⇒ Shell
constructor
A new instance of Shell.
- #run_cli ⇒ Object
Constructor Details
#initialize(vop = nil, options = {}) ⇒ Shell
Returns a new instance of Shell.
28 29 30 31 32 33 34 |
# File 'lib/vop/shell.rb', line 28 def initialize(vop = nil, = {}) @op = vop || Vop.new = backend = VopShellBackend.new(@op, :color_prompt => true) @base_shell = BaseShell.new(backend) end |
Instance Attribute Details
#op ⇒ Object (readonly)
Returns the value of attribute op.
26 27 28 |
# File 'lib/vop/shell.rb', line 26 def op @op end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
25 26 27 |
# File 'lib/vop/shell.rb', line 25 def end |
Class Method Details
.setup ⇒ Object
44 45 46 47 48 49 |
# File 'lib/vop/shell.rb', line 44 def self.setup() = Docopt::docopt(USAGE, {:help => true}) vop = Vop.new() return Shell.new(vop, ) end |
Instance Method Details
#execute(string) ⇒ Object
36 37 38 |
# File 'lib/vop/shell.rb', line 36 def execute(string) @base_shell.backend.process_input(string) end |
#run_cli ⇒ Object
40 41 42 |
# File 'lib/vop/shell.rb', line 40 def run_cli @base_shell.run end |