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 Homebrew
module_function module_function
def extract def extract_args
Homebrew::CLI::Parser.parse do Homebrew::CLI::Parser.new do
flag "--version=" 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 :debug
switch :force switch :force
end end
end
def extract
extract_args.parse
# Expect exactly two named arguments: formula and tap # Expect exactly two named arguments: formula and tap
raise UsageError if ARGV.named.length != 2 raise UsageError if ARGV.named.length != 2

View File

@ -21,6 +21,7 @@ require "dev-cmd/irb"
require "dev-cmd/linkage" require "dev-cmd/linkage"
require "dev-cmd/mirror" require "dev-cmd/mirror"
require "dev-cmd/pull" require "dev-cmd/pull"
require "dev-cmd/extract"
require "dev-cmd/release-notes" require "dev-cmd/release-notes"
require "dev-cmd/tap-new" require "dev-cmd/tap-new"
require "dev-cmd/tests" 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. no `formula` is provided.
* `extract` [`--force`] `formula` `tap` [`--version=``version`]: ###`extract` [`options`] `formula` `tap`
Looks through repository history to find the `version` of `formula` and Looks through repository history to find the `version` of `formula` and
creates a copy in `tap`/Formula/`formula`@`version`.rb. If the tap is creates a copy in `tap`/Formula/`formula`@`version`.rb. If the tap is
not installed yet, attempts to install/clone the tap before continuing. not installed yet, attempts to install/clone the tap before continuing.
If `--force` is passed, the file at the destination will be overwritten * `--version`:
if it already exists. Otherwise, existing files will be preserved. 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.
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.
###`formula` `formula`: ###`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:" .SS "\fBedit\fR \fIformula\fR:"
Open \fIformula\fR in the editor\. Open all of Homebrew for editing if no \fIformula\fR is provided\. Open \fIformula\fR in the editor\. Open all of Homebrew for editing if no \fIformula\fR is provided\.
. .
.TP .SS "\fBextract\fR [\fIoptions\fR] \fIformula\fR \fItap\fR"
\fBextract\fR [\fB\-\-force\fR] \fIformula\fR \fItap\fR [\fB\-\-version=\fR\fIversion\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\. 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 .TP
If \fB\-\-force\fR is passed, the file at the destination will be overwritten if it already exists\. Otherwise, existing files will be preserved\. \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\.
.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\.
. .
.SS "\fBformula\fR \fIformula\fR:" .SS "\fBformula\fR \fIformula\fR:"
Display the path where \fIformula\fR is located\. Display the path where \fIformula\fR is located\.