extract: Add option descriptions

This commit is contained in:
Gautham Goli 2018-10-03 20:16:05 +05:30
parent f6081d6ab0
commit 38feaf1270
No known key found for this signature in database
GPG Key ID: 6A9ABBC284468364
4 changed files with 28 additions and 19 deletions

View File

@ -96,12 +96,26 @@ end
module Homebrew
module_function
def extract
Homebrew::CLI::Parser.parse do
flag "--version="
def extract_args
Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`extract` [<options>] <formula> <tap>
Looks through repository history to find the <version> of <formula> and
creates a copy in <tap>/Formula/<formula>@<version>.rb. If the tap is
not installed yet, attempts to install/clone the tap before continuing.
EOS
flag "--version=",
description: "Provided <version> of <formula> will be extracted and placed in the destination "\
"tap. Otherwise, the most recent version that can be found will be used."
switch :debug
switch :force
end
end
def extract
extract_args.parse
# Expect exactly two named arguments: formula and tap
raise UsageError if ARGV.named.length != 2

View File

@ -21,6 +21,7 @@ require "dev-cmd/irb"
require "dev-cmd/linkage"
require "dev-cmd/mirror"
require "dev-cmd/pull"
require "dev-cmd/extract"
require "dev-cmd/release-notes"
require "dev-cmd/tap-new"
require "dev-cmd/tests"

View File

@ -794,17 +794,14 @@ Takes a tap [`user``/``repo`] as argument and generates the formula in the speci
no `formula` is provided.
* `extract` [`--force`] `formula` `tap` [`--version=``version`]:
Looks through repository history to find the `version` of `formula` and
creates a copy in `tap`/Formula/`formula`@`version`.rb. If the tap is
not installed yet, attempts to install/clone the tap before continuing.
###`extract` [`options`] `formula` `tap`
If `--force` is passed, the file at the destination will be overwritten
if it already exists. Otherwise, existing files will be preserved.
Looks through repository history to find the `version` of `formula` and
creates a copy in `tap`/Formula/`formula`@`version`.rb. If the tap is
not installed yet, attempts to install/clone the tap before continuing.
If an argument is passed through `--version`, `version` of `formula`
will be extracted and placed in the destination tap. Otherwise, the most
recent version that can be found will be used.
* `--version`:
Provided `version` of `formula` will be extracted and placed in the destination tap. Otherwise, the most recent version that can be found will be used.
###`formula` `formula`:

View File

@ -794,15 +794,12 @@ Takes a tap [\fIuser\fR\fB/\fR\fIrepo\fR] as argument and generates the formula
.SS "\fBedit\fR \fIformula\fR:"
Open \fIformula\fR in the editor\. Open all of Homebrew for editing if no \fIformula\fR is provided\.
.
.TP
\fBextract\fR [\fB\-\-force\fR] \fIformula\fR \fItap\fR [\fB\-\-version=\fR\fIversion\fR]
.SS "\fBextract\fR [\fIoptions\fR] \fIformula\fR \fItap\fR"
Looks through repository history to find the \fIversion\fR of \fIformula\fR and creates a copy in \fItap\fR/Formula/\fIformula\fR@\fIversion\fR\.rb\. If the tap is not installed yet, attempts to install/clone the tap before continuing\.
.
.IP
If \fB\-\-force\fR is passed, the file at the destination will be overwritten if it already exists\. Otherwise, existing files will be preserved\.
.
.IP
If an argument is passed through \fB\-\-version\fR, \fIversion\fR of \fIformula\fR will be extracted and placed in the destination tap\. Otherwise, the most recent version that can be found will be used\.
.TP
\fB\-\-version\fR
Provided \fIversion\fR of \fIformula\fR will be extracted and placed in the destination tap\. Otherwise, the most recent version that can be found will be used\.
.
.SS "\fBformula\fR \fIformula\fR:"
Display the path where \fIformula\fR is located\.