Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sh: Use CLI::Parser to parse args #5576

Merged
merged 1 commit into from
Jan 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions Library/Homebrew/cmd/sh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,31 @@

require "extend/ENV"
require "formula"
require "cli_parser"

module Homebrew
module_function

def sh_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`sh` [<options>]

Start a Homebrew build environment shell. Uses our years-battle-hardened
Homebrew build logic to help your `./configure && make && make install`
or even your `gem install` succeed. Especially handy if you run Homebrew
in an Xcode-only configuration since it adds tools like `make` to your `PATH`
which otherwise build systems would not find.
EOS
flag "--env=",
description: "Use the standard `PATH` instead of superenv's, when <std> is passed"
switch :verbose
switch :debug
end
end

def sh
sh_args.parse
ENV.activate_extensions!

if superenv?
Expand Down