Module: Spectator::CommandLine

Included in:
Runner
Defined in:
lib/spectator/command_line.rb

Instance Method Summary collapse

Instance Method Details

#clear!Object



15
16
17
# File 'lib/spectator/command_line.rb', line 15

def clear!
  system 'clear'
end

#run(cmd) ⇒ Object



8
9
10
11
12
13
# File 'lib/spectator/command_line.rb', line 8

def run cmd
  puts "=== running: #{cmd} ".ljust(terminal_columns, '=').cyan
  success = system cmd
  puts "===".ljust(terminal_columns, '=').cyan
  success
end

#terminal_columnsObject



3
4
5
6
# File 'lib/spectator/command_line.rb', line 3

def terminal_columns
  cols = `stty -a 2>&1`.scan(/ (\d+) columns/).flatten.first
  $?.success? ? cols.to_i : 0
end