Monkey-patch the help text when showing management command help in rb-site.
Review Request #11361 — Created Jan. 7, 2021 and submitted — Latest diff uploaded
When running
rb-site manage ... <command> --help
, we'd show the
standard management command help text that Django displays. This would
end up showing the wrong program invocation, which wasn't helpful. For
instance:rbsite.py set-siteconfig
When we wanted something like:
rb-site manage /var/www/reviewboard set-siteconfig
This change fixes that by ditching the
execute_from_command_line()
wrapper function and instead creating aManagementUtility
directly,
where we set the correct program name in order to get the right command
in the standardmanage.py --help
list of commands. We then pass in
rb-site-manage
as a placeholder program name, which gets replaced in a
monkey-patched parser wrapper.This is, unfortunately, the only way to do that without outright
replacing Django management command infrastructure, but should be safe
to do.
Tested both
rb-site manage /path/to/site -- --help
and
rb-site manage /path/to/site <command> -- --help
for several different
commands. Saw a useful "usage:" line in the help with the full command.