Sha256: 7387397f5e71007c2a5d2f33b04f001d0b5e43190c5d5ed1d113204ed7bcfd5b

Contents?: true

Size: 473 Bytes

Versions: 1

Compression:

Stored size: 473 Bytes

Contents

require_relative "out"
module Bash
  def _bash(cmd)
    cmd = handle_path(cmd)
    result = `#{cmd}`
    Out.out result
  end

  def handle_path(cmd)
    r = cmd[/\/(\w|\/)*/]
    if r
      cmd.gsub! r, "\'#{r}\'"
    else
      cmd
    end
  end

  def bash(*cmds)
    unless cmds.empty?
      _bash(cmds.flatten.join(" && "))
    end
  end

  def bash_per(*cmds)
    cmds.each do |c|
      bash c
    end
  end

  def bash_lines(cmd)
    bash(cmd).split("\n")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ro_commands-0.0.1 lib/ro_commands/helpers/bash.rb