dev-cmd/man: display diff --stat, add --exit-code
The --fail-if-changed option will cause `brew man` to return a failing status code if the man files have changed.
This commit is contained in:
parent
d624627885
commit
44d13ce256
@ -1,5 +1,9 @@
|
|||||||
#: * `man`:
|
#: * `man` [`--fail-if-changed`]:
|
||||||
#: Generate Homebrew's manpages.
|
#: Generate Homebrew's manpages.
|
||||||
|
#:
|
||||||
|
#: If `--fail-if-changed` is passed, the command will return a failing
|
||||||
|
#: status code if changes are detected in the manpage outputs.
|
||||||
|
#: This can be used for CI to be notified when the manpages are out of date.
|
||||||
|
|
||||||
require "formula"
|
require "formula"
|
||||||
require "erb"
|
require "erb"
|
||||||
@ -18,6 +22,12 @@ module Homebrew
|
|||||||
else
|
else
|
||||||
regenerate_man_pages
|
regenerate_man_pages
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if system "git", "-C", HOMEBREW_REPOSITORY, "diff", "--quiet", "docs/brew.1.html", "manpages"
|
||||||
|
puts "No changes to manpage output detected."
|
||||||
|
elsif ARGV.include?("--fail-if-changed")
|
||||||
|
Homebrew.failed = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user