class Kontena::Plugin::Shell::BatchDoCommand
Public Instance Methods
execute()
click to toggle source
# File lib/kontena/plugin/shell/commands/batch_do.rb, line 12 def execute if args.size > 1 lines = args[1..-1].join(' ').split(/(?<!\\);/).map(&:strip) else lines = [] while buf = Readline.readline("#{Kontena.pastel.green('..')}#{Kontena.pastel.red('>')} ", true) buf.strip! break if buf == 'end' lines << buf unless buf.empty? end (lines.size + 1).times { Readline::HISTORY.pop } Readline::HISTORY.push "batch do #{lines.join('; ')}" end lines.each { |line| session.run_command(line) } end