Sha256: bbd7352d3e4d54c97315f44eb2bcde288d95151f54f1b3337f5708c99153cd62
Contents?: true
Size: 756 Bytes
Versions: 5
Compression:
Stored size: 756 Bytes
Contents
require 'term/ansicolor' class String include Term::ANSIColor end require 'tabulo' require 'fileutils' require 'tmpdir' module Hackmac module Utils include FileUtils 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 def ask(prompt) print prompt.bold.yellow gets =~ /\Ay/i end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
hackmac-0.4.2 | lib/hackmac/utils.rb |
hackmac-0.4.1 | lib/hackmac/utils.rb |
hackmac-0.3.2 | lib/hackmac/utils.rb |
hackmac-0.3.1 | lib/hackmac/utils.rb |
hackmac-0.3.0 | lib/hackmac/utils.rb |