aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorLarry Shaffer2013-12-11 08:10:03 +0000
committerMike McQuaid2013-12-11 08:10:11 +0000
commit32726535393df26e6f2a0b8d972b3b1a2d7afa12 (patch)
tree48621ce6d0e597ce236a9e1011c01c5a5c890a5e /Library
parenta412577c1b66dfe597afeae69eecf6c7218efa94 (diff)
downloadhomebrew-32726535393df26e6f2a0b8d972b3b1a2d7afa12.tar.bz2
brew-bundle: update usage info and move to --help function
Follow-up to 6697ff6c9d0d4301adfbb7c76628808a63f1324b Closes #25130. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Contributions/cmd/brew-bundle.rb44
1 files changed, 29 insertions, 15 deletions
diff --git a/Library/Contributions/cmd/brew-bundle.rb b/Library/Contributions/cmd/brew-bundle.rb
index 0a9ce1ebc..ec1898e09 100755
--- a/Library/Contributions/cmd/brew-bundle.rb
+++ b/Library/Contributions/cmd/brew-bundle.rb
@@ -1,19 +1,33 @@
# brew-bundle.rb
-#
-# Usage: brew bundle [path]
-#
-# Looks for a Brewfile and runs each line as a brew command.
-#
-# brew bundle # Looks for "./Brewfile"
-# brew bundle path/to/dir # Looks for "path/to/dir/Brewfile"
-# brew bundle path/to/file # Looks for "path/to/file"
-#
-# For example, given a Brewfile with the following contents:
-# tap foo/bar
-# install spark
-#
-# Running `brew bundle` will run the commands `brew tap foo/bar`
-# and `brew install spark`.
+
+def usage
+ puts <<-EOS.undent
+ Usage: brew bundle [path]
+
+ Looks for a Brewfile and runs each line as a brew command.
+
+ brew bundle # Looks for "./Brewfile"
+ brew bundle path/to/dir # Looks for "path/to/dir/Brewfile"
+ brew bundle path/to/file # Looks for "path/to/file"
+
+ For example, given a Brewfile with the following content:
+ install formula
+
+ Running `brew bundle` will run the command `brew install formula`.
+
+ NOTE: Not all brew commands will work consistently in a Brewfile.
+ Some commands will raise errors which will stop execution of the Brewfile.
+
+ Example that outputs an error:
+ tap my/tap # fails when my/tap has already been tapped
+
+ In this case use the full formula path in the Brewfile instead:
+ install my/tap/formula # succeeds even when my/tap has already been tapped
+ EOS
+ exit
+end
+
+usage if ARGV.include?('--help') || ARGV.include?('-h')
path = 'Brewfile'
error = ' in current directory'