From a558629654c28fff1ccfb8e9895485e0da79e167 Mon Sep 17 00:00:00 2001
From: Jam
Date: Sun, 8 May 2016 20:39:22 -0600
Subject: [PATCH] gist-logs: add proper documentation, improve error handling
(#217)
---
Library/Homebrew/cmd/gist-logs.rb | 17 ++++++++++++-----
Library/Homebrew/cmd/install.rb | 2 +-
share/doc/homebrew/brew.1.html | 11 ++++++++++-
share/man/man1/brew.1 | 15 ++++++++++++++-
4 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb
index f51e20ed3a..543bd6289a 100644
--- a/Library/Homebrew/cmd/gist-logs.rb
+++ b/Library/Homebrew/cmd/gist-logs.rb
@@ -1,3 +1,14 @@
+#: * `gist-logs` [`--new-issue`|`-n`] :
+#: Upload logs for a failed build of to a new Gist.
+#:
+#: is usually the name of the formula to install, but it can be specified
+#: in several different ways. See [SPECIFYING FORMULAE][].
+#:
+#: If `--new-issue` is passed, automatically create a new issue in the appropriate
+#: GitHub repository as well as creating the Gist.
+#:
+#: If no logs are found, an error message is presented.
+
require "formula"
require "system_config"
require "net/http"
@@ -161,11 +172,7 @@ module Homebrew
end
def gist_logs
- if ARGV.resolved_formulae.length != 1
- puts "usage: brew gist-logs [--new-issue|-n] "
- Homebrew.failed = true
- return
- end
+ raise FormulaUnspecifiedError if ARGV.resolved_formulae.length != 1
gistify_logs(ARGV.resolved_formulae[0])
end
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index d41ef66d45..9d2c7bfa15 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -2,7 +2,7 @@
#: Install .
#:
#: is usually the name of the formula to install, but it can be specified
-#: several different ways. See [SPECIFYING FORMULAE][].
+#: in several different ways. See [SPECIFYING FORMULAE][].
#:
#: If `--debug` is passed and brewing fails, open an interactive debugging
#: session with access to IRB or a shell inside the temporary build directory.
diff --git a/share/doc/homebrew/brew.1.html b/share/doc/homebrew/brew.1.html
index fa5a1e9bb5..bd6f9f5cf5 100644
--- a/share/doc/homebrew/brew.1.html
+++ b/share/doc/homebrew/brew.1.html
@@ -157,6 +157,15 @@ bottle.
If --force-bottle is passed, download a bottle if it exists for the current
version of OS X, even if it would not be used during installation.
+gist-logs [--new-issue|-n] formula Upload logs for a failed build of formula to a new Gist.
+
+ formula is usually the name of the formula to install, but it can be specified
+ in several different ways. See SPECIFYING FORMULAE.
+
+ If --new-issue is passed, automatically create a new issue in the appropriate
+ GitHub repository as well as creating the Gist.
+
+ If no logs are found, an error message is presented.
homeOpen Homebrew's own homepage in a browser.
home formulaOpen formula's homepage in a browser.
info formulaDisplay information about formula.
@@ -174,7 +183,7 @@ information on all installed formulae.
install [--debug] [--env=std|super] [--ignore-dependencies] [--only-dependencies] [--cc=compiler] [--build-from-source|--force-bottle] [--devel|--HEAD] [--keep-tmp] formulaInstall formula.
formula is usually the name of the formula to install, but it can be specified
-several different ways. See SPECIFYING FORMULAE.
+in several different ways. See SPECIFYING FORMULAE.
If --debug is passed and brewing fails, open an interactive debugging
session with access to IRB or a shell inside the temporary build directory.
diff --git a/share/man/man1/brew.1 b/share/man/man1/brew.1
index badfa86ca8..9db7b58c4e 100644
--- a/share/man/man1/brew.1
+++ b/share/man/man1/brew.1
@@ -211,6 +211,19 @@ If \fB\-\-build\-from\-source\fR is passed, download the source rather than a bo
If \fB\-\-force\-bottle\fR is passed, download a bottle if it exists for the current version of OS X, even if it would not be used during installation\.
.
.TP
+\fBgist\-logs\fR [\fB\-\-new\-issue\fR|\fB\-n\fR] \fIformula\fR
+Upload logs for a failed build of \fIformula\fR to a new Gist\.
+.
+.IP
+\fIformula\fR is usually the name of the formula to install, but it can be specified in several different ways\. See \fISPECIFYING FORMULAE\fR\.
+.
+.IP
+If \fB\-\-new\-issue\fR is passed, automatically create a new issue in the appropriate GitHub repository as well as creating the Gist\.
+.
+.IP
+If no logs are found, an error message is presented\.
+.
+.TP
\fBhome\fR
Open Homebrew\'s own homepage in a browser\.
.
@@ -244,7 +257,7 @@ See the docs for examples of using the JSON: \fIhttps://github\.com/Homebrew/bre
Install \fIformula\fR\.
.
.IP
-\fIformula\fR is usually the name of the formula to install, but it can be specified several different ways\. See \fISPECIFYING FORMULAE\fR\.
+\fIformula\fR is usually the name of the formula to install, but it can be specified in several different ways\. See \fISPECIFYING FORMULAE\fR\.
.
.IP
If \fB\-\-debug\fR is passed and brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory\.