A nice API for constructing complex shell commands
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.rbenv-version
Gemfile
README.md
Rakefile
sh.gemspec

README.md

Sh::Cmd

Sh::Cmd is useful for constructing large Sh commands programmatically. It also has the benefit of Shell escaping any args you pass.

Usage:

cmd = Sh::Cmd.new("git") do |c|
  c.arg "log"
  c.opt "--oneline"
end

# OR

cmd = Sh::Cmd.new("git").arg("log").opt("--oneline")

puts cmd # => "git log --oneline"