Class: Ora::Cli::Bash
- Inherits:
-
Object
- Object
- Ora::Cli::Bash
- Defined in:
- lib/ora/cli/bash.rb
Instance Attribute Summary collapse
-
#unprocessed_commands ⇒ Object
readonly
Returns the value of attribute unprocessed_commands.
Instance Method Summary collapse
-
#initialize(target, from: nil, print: Print.new) ⇒ Bash
constructor
A new instance of Bash.
- #run(commands) ⇒ Object
- #select(command) ⇒ Object
- #silent(command) ⇒ Object
- #success? ⇒ Boolean
Constructor Details
Instance Attribute Details
#unprocessed_commands ⇒ Object (readonly)
Returns the value of attribute unprocessed_commands.
6 7 8 |
# File 'lib/ora/cli/bash.rb', line 6 def unprocessed_commands @unprocessed_commands end |
Instance Method Details
#run(commands) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ora/cli/bash.rb', line 20 def run commands @success = true @unprocessed_commands = extract commands outputs = [] command = '' while (command = complete @unprocessed_commands.shift) next if command.empty? if method? command sub_commands = call_method command @unprocessed_commands.unshift(*extract(sub_commands)) else @success, output = shell command outputs.push output break unless @success end end @unprocessed_commands.unshift(command) unless @success join outputs end |
#select(command) ⇒ Object
44 45 46 |
# File 'lib/ora/cli/bash.rb', line 44 def select command `#{move}#{command} | #{Path.selecta}`.strip end |
#silent(command) ⇒ Object
16 17 18 |
# File 'lib/ora/cli/bash.rb', line 16 def silent command `#{move}#{command}#{capture_err}` end |
#success? ⇒ Boolean
48 49 50 |
# File 'lib/ora/cli/bash.rb', line 48 def success? @success end |