diff options
| author | Baptiste Fontaine | 2015-06-15 12:41:12 +0200 |
|---|---|---|
| committer | Baptiste Fontaine | 2015-06-18 20:06:11 +0200 |
| commit | bd42901fa7146729395706e019b3bc2e445e4b7c (patch) | |
| tree | e5d3753e0f49821802daa86345ba43aaa3e36f1f | |
| parent | d770a874e466d1e9a8df7672b37102291056cae1 (diff) | |
| download | brew-bd42901fa7146729395706e019b3bc2e445e4b7c.tar.bz2 | |
'brew man': abort if a formula is given
Closes Homebrew/homebrew#40735.
Closes Homebrew/homebrew#40736.
Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
| -rw-r--r-- | Library/Homebrew/cmd/man.rb | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/Library/Homebrew/cmd/man.rb b/Library/Homebrew/cmd/man.rb index c1a202156..bba81efa5 100644 --- a/Library/Homebrew/cmd/man.rb +++ b/Library/Homebrew/cmd/man.rb @@ -6,32 +6,30 @@ module Homebrew LINKED_PATH=HOMEBREW_PREFIX/"share/man/man1" def man - if ARGV.include?("--link") || ARGV.include?("-l") + abort <<-EOS.undent unless ARGV.named.empty? + This command updates the brew manpage and does not take formula names. + EOS + + if ARGV.flag? "--link" + abort <<-EOS.undent if TARGET_PATH == LINKED_PATH + The target path is the same as the linked one, aborting. + EOS Dir["#{TARGET_PATH}/*.1"].each do |page| FileUtils.ln_s page, LINKED_PATH return end - end + else + Homebrew.install_gem_setup_path! "ronn" - Homebrew.install_gem_setup_path! "ronn" - - if ARGV.include?("--server") || ARGV.include?("-s") - puts "Man page test server: http://localhost:1207/" - puts "Control-C to exit." - system "ronn", "--server", Dir["#{SOURCE_PATH}/*"] - return - end + puts "Writing manpages to #{TARGET_PATH}" - puts "Writing manpages to #{TARGET_PATH}" - - target_file = nil - Dir["#{SOURCE_PATH}/*.md"].each do |source_file| - target_file = TARGET_PATH/File.basename(source_file, ".md") - safe_system "ronn --roff --pipe --organization='Homebrew' --manual='brew' #{source_file} > #{target_file}" - end + target_file = nil + Dir["#{SOURCE_PATH}/*.md"].each do |source_file| + target_file = TARGET_PATH/File.basename(source_file, ".md") + safe_system "ronn --roff --pipe --organization='Homebrew' --manual='brew' #{source_file} > #{target_file}" + end - if ARGV.include?("--verbose") || ARGV.include?("-v") - system "man", target_file + system "man", target_file if ARGV.flag? "--verbose" end end end |
