module Hackmac::Utils

def ask(prompt)

def ask(prompt)
  print prompt.bold.yellow
  gets =~ /\Ay/i
end

def x(cmd, verbose: true)

def x(cmd, verbose: true)
  prompt = cmd =~ /\A\s*sudo/ ? ?# : ?$
  output = `#{cmd}`
  if $?.success?
    print "#{prompt} #{cmd}".green
    puts verbose ? "" : " >/dev/null".yellow
  else
    print "#{prompt} #{cmd}".red
    puts verbose ? "" : " >/dev/null".yellow
    STDERR.puts "command #{cmd.inspect} failed with exit status #{$?.exitstatus}".on_red.white
  end
  if verbose
    print output.italic
  end
  output
end