Skip to content

Commit

Permalink
Merge pull request #5718 from mtmiller/update-cmd-opts
Browse files Browse the repository at this point in the history
Add `brew update -f` option and improve help string format
  • Loading branch information
MikeMcQuaid authored Mar 17, 2019
2 parents 587c8f0 + fcd712e commit 417a16f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
8 changes: 6 additions & 2 deletions Library/Homebrew/cmd/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
#:
#: Fetch the newest version of Homebrew and all formulae from GitHub using `git`(1) and perform any necessary migrations.
#:
#: --merge `git merge` is used to include updates (rather than `git rebase`).
#: --force Always do a slower, full update check (even if unnecessary).
#: --merge `git merge` is used to include updates (rather than `git rebase`).
#: -f, --force Always do a slower, full update check (even if unnecessary).
#: -v, --verbose Print the directories checked and `git` operations performed.
#: -d, --debug Display a trace of all shell commands as they are executed.
#: -h, --help Show this message.

# Don't need shellcheck to follow this `source`.
# shellcheck disable=SC1090
Expand Down Expand Up @@ -306,6 +309,7 @@ homebrew-update() {
-*)
[[ "$option" = *v* ]] && HOMEBREW_VERBOSE=1
[[ "$option" = *d* ]] && HOMEBREW_DEBUG=1
[[ "$option" = *f* ]] && HOMEBREW_UPDATE_FORCE=1
;;
*)
odie <<EOS
Expand Down
7 changes: 6 additions & 1 deletion Library/Homebrew/dev-cmd/man.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,12 @@ def cmd_comment_manpage_lines(cmd_path)
line = line.slice(4..-1)
next unless line

lines << line.gsub(/^ +(-+[a-z-]+) */, "* `\\1`:\n ")
# 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.
lines << line.gsub(/^ +(-+[a-z-]+), (-+[a-z-]+) +/, "* `\\1`, `\\2`:\n ")
.gsub(/^ +(-+[a-z-]+) +/, "* `\\1`:\n ")
end
lines
end
Expand Down
3 changes: 0 additions & 3 deletions docs/Manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,6 @@ Fetch the newest version of Homebrew and all formulae from GitHub using `git`(1)
* `--merge`:
`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`*]
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.

Expand Down
4 changes: 0 additions & 4 deletions manpages/brew.1
Original file line number Diff line number Diff line change
Expand Up @@ -660,10 +660,6 @@ Fetch the newest version of Homebrew and all formulae from GitHub using \fBgit\f
\fB\-\-merge\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]"
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\.
.
Expand Down

0 comments on commit 417a16f

Please sign in to comment.