--version: move help to documentation comment

This implies that `--version` is treated in most places like a regular
command, e.g. being suggested in shell completion. Also fix the help
text that claimed output goes to standard error, while it actually goes
to standard output.
This commit is contained in:
Martin Afanasjew 2016-04-19 03:04:49 +02:00
parent 76f0479969
commit 312fdaa892
4 changed files with 14 additions and 5 deletions

View File

@ -0,0 +1,12 @@
#: * `--version`:
#: Print the version number of Homebrew to standard output and exit.
module Homebrew
def __version
# As a special case, `--version` is implemented directly in `brew.rb`. This
# file merely serves as a container for the documentation. It also catches
# the case where running `brew --version` with additional arguments would
# produce a rather cryptic message about a non-existent `--version` command.
raise UsageError
end
end

View File

@ -50,9 +50,6 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note
<%= commands.join("\n") %>
* `--version`:
Print the version number of brew to standard error and exit.
## EXTERNAL COMMANDS
Homebrew, like `git`(1), supports external commands. These are executable

View File

@ -410,7 +410,7 @@ without any sort of versioned directory as the last path.</p></dd>
<dt><code>--repository</code></dt><dd><p>Display where Homebrew's <code>.git</code> directory is located. For standard installs,
the <code>prefix</code> and <code>repository</code> are the same directory.</p></dd>
<dt><code>--repository</code> <var>user</var><code>/</code><var>repo</var></dt><dd><p>Display where tap <var>user</var><code>/</code><var>repo</var>'s directory is located.</p></dd>
<dt><code>--version</code></dt><dd><p>Print the version number of brew to standard error and exit.</p></dd>
<dt><code>--version</code></dt><dd><p>Print the version number of Homebrew to standard output and exit.</p></dd>
</dl>

View File

@ -586,7 +586,7 @@ Display where tap \fIuser\fR\fB/\fR\fIrepo\fR\'s directory is located\.
.
.TP
\fB\-\-version\fR
Print the version number of brew to standard error and exit\.
Print the version number of Homebrew to standard output and exit\.
.
.SH "EXTERNAL COMMANDS"
Homebrew, like \fBgit\fR(1), supports external commands\. These are executable scripts that reside somewhere in the \fBPATH\fR, named \fBbrew\-\fR\fIcmdname\fR or \fBbrew\-\fR\fIcmdname\fR\fB\.rb\fR, which can be invoked like \fBbrew\fR \fIcmdname\fR\. This allows you to create your own commands without modifying Homebrew\'s internals\.