'brew man': abort if a formula is given
Closes Homebrew/homebrew#40735. Closes Homebrew/homebrew#40736. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
This commit is contained in:
parent
d770a874e4
commit
bd42901fa7
@ -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"
|
||||
puts "Writing manpages to #{TARGET_PATH}"
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
if ARGV.include?("--verbose") || ARGV.include?("-v")
|
||||
system "man", target_file
|
||||
system "man", target_file if ARGV.flag? "--verbose"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user