Optimise/simplify brew help

Be more useful by being more concise. I referenced dozens of other mature commands’ usage to figure out what to do here.

Also separated out the help into its own command for consistency.
This commit is contained in:
Max Howell 2011-03-13 12:54:30 +00:00
parent 0d92987935
commit ec9cbc6466
4 changed files with 51 additions and 53 deletions

View File

@ -56,12 +56,12 @@ didn't include with OS X.
If `--git` is passed, Homebrew will create a Git repository, useful for If `--git` is passed, Homebrew will create a Git repository, useful for
creating patches to the software. creating patches to the software.
* `-S`, `search` <text>|/<text>/: * `search`, `-S` <text>|/<text>/:
Perform a substring search of formula names for <text>. If <text> is Perform a substring search of formula names for <text>. If <text> is
surrounded with slashes, then it is interpreted as a regular expression. surrounded with slashes, then it is interpreted as a regular expression.
If no search term is given, all available formula are displayed. If no search term is given, all available formula are displayed.
* `-S --macports`|`--fink` <text>: * `search --macports`|`--fink` <text>:
Search for <text> on the MacPorts or Fink package search page. Search for <text> on the MacPorts or Fink package search page.
* `update`: * `update`:
@ -96,14 +96,14 @@ didn't include with OS X.
If `--force` is passed, and there are multiple versions of <formula> If `--force` is passed, and there are multiple versions of <formula>
installed, delete all installed versions. installed, delete all installed versions.
* `create [--cache]` <URL>: * `create [--no-fetch]` <URL>:
Generate a formula for the downloadable file at <URL> and opens it in Generate a formula for the downloadable file at <URL> and opens it in
$EDITOR. Homebrew will attempt to automatically derive the formula name $EDITOR. Homebrew will attempt to automatically derive the formula name
and version, if it fails, you'll have to make your own template. I suggest and version, if it fails, you'll have to make your own template. I suggest
copying wget's. copying wget's.
If `--cache` is passed, Homebrew will download the <URL> to the cache and If `--no-fetch` is passed, Homebrew will not download <URL> to the cache and
add the MD5 to the formula for you. will thus not add the MD5 to the formula for you.
* `edit` <formula>: * `edit` <formula>:
Open <formula> in $EDITOR. Open <formula> in $EDITOR.

View File

@ -0,0 +1,40 @@
HOMEBREW_HELP = <<-EOS
Example usage:
brew install FORMULA...
brew uninstall FORMULA...
brew search [foo]
brew list [FORMULA...]
brew update
brew outdated
brew [info | home] [FORMULA...]
Troubleshooting:
brew doctor
brew install -vd FORMULA
brew [--env | --config]
Brewing:
brew create [URL [--no-fetch]]
brew edit [FORMULA...]
open https://github.com/mxcl/homebrew/wiki/Formula-Cookbook
Further help:
man brew
brew home
EOS
# NOTE Keep the lenth of vanilla --help less than 25 lines!
# This is because the default Terminal height is 25 lines. Scrolling sucks
# and concision is important. If more help is needed we should start
# specialising help like the gem command does.
# NOTE Keep lines less than 80 characters! Wrapping is just not cricket.
# NOTE The reason the string is at the top is so 25 lines is easy to measure!
module Homebrew extend self
def help
puts HOMEBREW_HELP
end
def help_s
HOMEBREW_HELP
end
end

View File

@ -67,51 +67,9 @@ module HomebrewArgvExtension
return false return false
end end
def usage; <<-EOS.undent def usage
Usage: brew [-v|--version] [--prefix [formula]] [--cache [formula]] require 'cmd/help'
[--cellar [formula]] [--config] [--env] [--repository] Homebrew.help_s
[-h|--help] COMMAND [formula] ...
Principal Commands:
install formula ... [--ignore-dependencies] [--HEAD]
list [--unbrewed|--versions] [formula] ...
search [/regex/] [substring]
uninstall formula ...
update
Other Commands:
info formula [--github]
options formula
deps formula
uses formula [--installed]
home formula ...
cleanup [formula]
link formula ...
unlink formula ...
outdated
missing
prune
doctor
Informational:
--version
--config
--prefix [formula]
--cache [formula]
Commands useful when contributing:
create URL
edit [formula]
audit [formula]
log formula
install formula [-vd|-i]
For more information:
man brew
To visit the Homebrew homepage type:
brew home
EOS
end end
private private

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BREW" "1" "February 2011" "Homebrew" "brew" .TH "BREW" "1" "March 2011" "Homebrew" "brew"
. .
.SH "NAME" .SH "NAME"
\fBbrew\fR \- The missing package manager for OS X \fBbrew\fR \- The missing package manager for OS X
@ -60,11 +60,11 @@ Download and patch \fIformula\fR, then open a shell\. This allows the user to ru
If \fB\-\-git\fR is passed, Homebrew will create a Git repository, useful for creating patches to the software\. If \fB\-\-git\fR is passed, Homebrew will create a Git repository, useful for creating patches to the software\.
. .
.TP .TP
\fB\-S\fR, \fBsearch\fR \fItext\fR|/\fItext\fR/ \fBsearch\fR, \fB\-S\fR \fItext\fR|/\fItext\fR/
Perform a substring search of formula names for \fItext\fR\. If \fItext\fR is surrounded with slashes, then it is interpreted as a regular expression\. If no search term is given, all available formula are displayed\. Perform a substring search of formula names for \fItext\fR\. If \fItext\fR is surrounded with slashes, then it is interpreted as a regular expression\. If no search term is given, all available formula are displayed\.
. .
.TP .TP
\fB\-S \-\-macports\fR|\fB\-\-fink\fR \fItext\fR \fBsearch \-\-macports\fR|\fB\-\-fink\fR \fItext\fR
Search for \fItext\fR on the MacPorts or Fink package search page\. Search for \fItext\fR on the MacPorts or Fink package search page\.
. .
.TP .TP