man: omit global options from shell command usage

When reading the comment header of a shell command, omit options that
are in Homebrew::CLI::Parser.global_options, since they are documented
separately for all commands.
This commit is contained in:
Mike Miller 2019-03-15 01:15:58 -07:00
parent a4c8fc74f7
commit 56ac7ed58b
3 changed files with 3 additions and 7 deletions

View File

@ -195,6 +195,9 @@ module Homebrew
line = line.slice(4..-1) line = line.slice(4..-1)
next unless line next unless line
# Omit the common global_options documented separately in the man page.
next if line =~ /--(debug|force|help|quiet|verbose) /
# Format one option or a comma-separated pair of short and long options. # Format one option or a comma-separated pair of short and long options.
lines << line.gsub(/^ +(-+[a-z-]+), (-+[a-z-]+) +/, "* `\\1`, `\\2`:\n ") lines << line.gsub(/^ +(-+[a-z-]+), (-+[a-z-]+) +/, "* `\\1`, `\\2`:\n ")
.gsub(/^ +(-+[a-z-]+) +/, "* `\\1`:\n ") .gsub(/^ +(-+[a-z-]+) +/, "* `\\1`:\n ")

View File

@ -540,9 +540,6 @@ Fetch the newest version of Homebrew and all formulae from GitHub using `git`(1)
* `--merge`: * `--merge`:
`git merge` is used to include updates (rather than `git rebase`). `git merge` is used to include updates (rather than `git rebase`).
* `--force`:
Always do a slower, full update check (even if unnecessary).
### `update-reset` [*`repository`*] ### `update-reset` [*`repository`*]
Fetches and resets Homebrew and all tap repositories (or any specified `repository`) using `git`(1) to their latest `origin/master`. Note this will destroy all your uncommitted or committed changes. Fetches and resets Homebrew and all tap repositories (or any specified `repository`) using `git`(1) to their latest `origin/master`. Note this will destroy all your uncommitted or committed changes.

View File

@ -660,10 +660,6 @@ Fetch the newest version of Homebrew and all formulae from GitHub using \fBgit\f
\fB\-\-merge\fR \fB\-\-merge\fR
\fBgit merge\fR is used to include updates (rather than \fBgit rebase\fR)\. \fBgit merge\fR is used to include updates (rather than \fBgit rebase\fR)\.
. .
.TP
\fB\-\-force\fR
Always do a slower, full update check (even if unnecessary)\.
.
.SS "\fBupdate\-reset\fR [\fIrepository\fR]" .SS "\fBupdate\-reset\fR [\fIrepository\fR]"
Fetches and resets Homebrew and all tap repositories (or any specified \fBrepository\fR) using \fBgit\fR(1) to their latest \fBorigin/master\fR\. Note this will destroy all your uncommitted or committed changes\. Fetches and resets Homebrew and all tap repositories (or any specified \fBrepository\fR) using \fBgit\fR(1) to their latest \fBorigin/master\fR\. Note this will destroy all your uncommitted or committed changes\.
. .