Skip to content
Snippets Groups Projects
Commit bd42901f authored by Baptiste Fontaine's avatar Baptiste Fontaine Committed by Baptiste Fontaine
Browse files

'brew man': abort if a formula is given


Closes Homebrew/homebrew#40735.

Closes Homebrew/homebrew#40736.

Signed-off-by: default avatarBaptiste Fontaine <batifon@yahoo.fr>
parent d770a874
No related branches found
No related tags found
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment