diff --git a/Library/Homebrew/cmd/man.rb b/Library/Homebrew/cmd/man.rb index c1a202156e568253eb2c9bd8885e76b1a67c85e0..bba81efa5249551ad3076424d36bc2436371f239 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