Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
be24e201
Unverified
Commit
be24e201
authored
6 years ago
by
Gautham Goli
Browse files
Options
Downloads
Patches
Plain Diff
tap: Use CLI::Parser to parse args
parent
fd820656
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Library/Homebrew/cmd/tap.rb
+45
-5
45 additions, 5 deletions
Library/Homebrew/cmd/tap.rb
with
45 additions
and
5 deletions
Library/Homebrew/cmd/tap.rb
+
45
−
5
View file @
be24e201
...
...
@@ -32,13 +32,53 @@
#: * `tap` `--list-pinned`:
#: List all pinned taps.
require
"cli_parser"
module
Homebrew
module_function
def
tap_args
Homebrew
::
CLI
::
Parser
.
new
do
usage_banner
<<~
EOS
`tap` [<options>] <user>`/`<repo> [<URL>]
Tap a formula repository.
List all installed taps when no arguments are passed.
With <URL> unspecified, taps a formula repository from GitHub using HTTPS.
Since so many taps are hosted on GitHub, this command is a shortcut for
`brew tap` <user>`/`<repo> `https://github.com/`<user>`/homebrew-`<repo>.
With <URL> specified, taps a formula repository from anywhere, using
any transport protocol that `git` handles. The one-argument form of `tap`
simplifies but also limits. This two-argument command makes no
assumptions, so taps can be cloned from places other than GitHub and
using protocols other than HTTPS, e.g., SSH, GIT, HTTP, FTP(S), RSYNC.
EOS
switch
"--full"
,
description:
"Use a full clone when tapping a repository. By default, the repository is "
\
"cloned as a shallow copy (`--depth=1`). To convert a shallow copy to a "
\
"full copy, you can retap passing `--full` without first untapping."
switch
"--force-auto-update"
,
description:
"Auto-update tap even if it is not hosted on GitHub. By default, only taps "
\
"hosted on GitHub are auto-updated (for performance reasons)."
switch
"--repair"
,
description:
"Migrate tapped formulae from symlink-based to directory-based structure."
switch
"--list-pinned"
,
description:
"List all pinned taps."
switch
"-q"
,
"--quieter"
,
description:
"Suppress any warnings."
switch
:debug
end
end
def
tap
if
ARGV
.
include?
"--repair"
tap_args
.
parse
if
args
.
repair?
Tap
.
each
(
&
:link_completions_and_manpages
)
elsif
ARGV
.
include?
"--
list
-
pinned
"
elsif
args
.
list
_
pinned
?
puts
Tap
.
select
(
&
:pinned?
).
map
(
&
:name
)
elsif
ARGV
.
named
.
empty?
puts
Tap
.
names
...
...
@@ -48,7 +88,7 @@ module Homebrew
tap
.
install
clone_target:
ARGV
.
named
.
second
,
force_auto_update:
force_auto_update?
,
full_clone:
full_clone?
,
quiet:
ARGV
.
quieter?
quiet:
args
.
quieter?
rescue
TapRemoteMismatchError
=>
e
odie
e
rescue
TapAlreadyTappedError
,
TapAlreadyUnshallowError
# rubocop:disable Lint/HandleExceptions
...
...
@@ -57,11 +97,11 @@ module Homebrew
end
def
full_clone?
ARGV
.
include?
(
"--
full
"
)
||
ARGV
.
homebrew_developer?
args
.
full
?
||
ARGV
.
homebrew_developer?
end
def
force_auto_update?
# if no relevant flag is present, return nil, meaning "no change"
true
if
ARGV
.
include?
(
"--
force
-
auto
-
update
"
)
true
if
args
.
force
_
auto
_
update
?
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment