From 38feaf12709d122c49d3d145c07c4d920df42d85 Mon Sep 17 00:00:00 2001 From: Gautham Goli Date: Wed, 3 Oct 2018 20:16:05 +0530 Subject: [PATCH] extract: Add option descriptions --- Library/Homebrew/dev-cmd/extract.rb | 20 +++++++++++++++++--- Library/Homebrew/dev-cmd/man.rb | 1 + docs/Manpage.md | 15 ++++++--------- manpages/brew.1 | 11 ++++------- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/Library/Homebrew/dev-cmd/extract.rb b/Library/Homebrew/dev-cmd/extract.rb index cce25a171e..7f3c89ac67 100644 --- a/Library/Homebrew/dev-cmd/extract.rb +++ b/Library/Homebrew/dev-cmd/extract.rb @@ -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` [] + + Looks through repository history to find the of and + creates a copy in /Formula/@.rb. If the tap is + not installed yet, attempts to install/clone the tap before continuing. + EOS + + flag "--version=", + description: "Provided of 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 diff --git a/Library/Homebrew/dev-cmd/man.rb b/Library/Homebrew/dev-cmd/man.rb index 84f38ceaf0..0cad8e98a5 100644 --- a/Library/Homebrew/dev-cmd/man.rb +++ b/Library/Homebrew/dev-cmd/man.rb @@ -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" diff --git a/docs/Manpage.md b/docs/Manpage.md index a676525aae..dea38a6dfb 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -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`: diff --git a/manpages/brew.1 b/manpages/brew.1 index e94959da44..6b543aab3c 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -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\.