Class: Ora::Cli::Bash
- Inherits:
-
Object
- Object
- Ora::Cli::Bash
- Defined in:
- lib/ora/cli/bash.rb
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
#initialize(target, from: nil, print: Print.new) ⇒ Bash
Returns a new instance of Bash.
6 7 8 9 10 11 |
# File 'lib/ora/cli/bash.rb', line 6 def initialize(target, from: nil, print: Print.new) @target = target @from = from @print = print @success = true end |
Instance Method Details
#run(commands) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ora/cli/bash.rb', line 17 def run commands @success = true unprocessed_commands = extract commands outputs = [] while (command = complete unprocessed_commands.shift) next if command.empty? break unless call command do |output| outputs.push output end end handle_failed unprocessed_commands join outputs end |
#select(command) ⇒ Object
34 35 36 |
# File 'lib/ora/cli/bash.rb', line 34 def select command `#{move}#{command} | #{Path.selecta}`.strip end |
#silent(command) ⇒ Object
13 14 15 |
# File 'lib/ora/cli/bash.rb', line 13 def silent command `#{move}#{command}#{capture_err}` end |
#success? ⇒ Boolean
38 39 40 |
# File 'lib/ora/cli/bash.rb', line 38 def success? @success end |