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-siteconfigWhen we wanted something like:
rb-site manage /var/www/reviewboard set-siteconfigThis change fixes that by ditching the
execute_from_command_line()
wrapper function and instead creating aManagementUtilitydirectly,
where we set the correct program name in order to get the right command
in the standardmanage.py --helplist of commands. We then pass in
rb-site-manageas 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 -- --helpand
rb-site manage /path/to/site <command> -- --helpfor several different
commands. Saw a useful "usage:" line in the help with the full command.