class Miniflow::TTYCommand

Miniflow uses tty-command to execute the command. Please see the following website for more information. ttytoolkit.org/

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/miniflow/tty_command.rb, line 36
def initialize(*args)
  # Do not output uuid
  super(*args, printer: CustomPretty, uuid: true)
end

Public Instance Methods

include_meta_character?(str) click to toggle source
# File lib/miniflow/tty_command.rb, line 52
def include_meta_character?(str)
  ['*', '?', '{', '}', '[', ']', '<', '>', '(', ')', '~', '&', '|', '\\',
   '$', ';', "'", '`', '"', "\n"].any? { |i| str.include?(i) }
end
run2(*args) click to toggle source

run2 can execute the command in which the UNIX pipeline is used.

# File lib/miniflow/tty_command.rb, line 42
def run2(*args)
  args.map!(&:to_s)
  command = args.join(' ')
  if include_meta_character?(command)
    run(command)
  else
    run(*args)
  end
end