brew/Library/Homebrew/dev-cmd/generate-man-completions.rb

42 lines
1.0 KiB
Ruby
Raw Normal View History

# typed: strict
# frozen_string_literal: true
require "abstract_command"
require "formula"
require "completions"
require "manpages"
2024-01-31 20:00:54 -08:00
require "system_command"
module Homebrew
module DevCmd
class GenerateManCompletions < AbstractCommand
include SystemCommand::Mixin
cmd_args do
description <<~EOS
Generate Homebrew's manpages and shell completions.
EOS
named_args :none
end
sig { override.void }
def run
Homebrew.install_bundler_gems!(groups: ["man"])
Commands.rebuild_internal_commands_completion_list
Manpages.regenerate_man_pages(quiet: args.quiet?)
Completions.update_shell_completions!
diff = system_command "git", args: [
"-C", HOMEBREW_REPOSITORY, "diff", "--exit-code", "docs/Manpage.md", "manpages", "completions"
]
if diff.status.success?
ofail "No changes to manpage or completions."
else
puts "Manpage and completions updated."
end
end
end
end
end