From c78c8178e651a09b09e75b74b8af95af7b851e6e Mon Sep 17 00:00:00 2001 From: lethliel Date: Fri, 19 Jul 2019 13:39:43 +0200 Subject: [PATCH] prevent plugins to break help prevent call of preprocessor if ${cmd_name} marker is accidentaly set, but cmdname is None. Also for cmd_option_list and cmd_usage overwrite _help_preprocess_* functions in Osc class --- osc/commandline.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/osc/commandline.py b/osc/commandline.py index 8ea37ba3..fdc2ccff 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -206,6 +206,20 @@ class Osc(cmdln.Cmdln): help_msg = cmdln.Cmdln._help_preprocess(self, help, cmdname) return help_msg % conf.config + def _help_preprocess_cmd_name(self, help, cmdname=None): + if cmdname is None: + return help + return cmdln.Cmdln._help_preprocess_cmd_name(self, help, cmdname) + + def _help_preprocess_cmd_option_list(self, help, cmdname=None): + if cmdname is None: + return help + return cmdln.Cmdln._help_preprocess_cmd_option_list(self, help, cmdname) + + def _help_preprocess_cmd_usage(self, help, cmdname=None): + if cmdname is None: + return help + return cmdln.Cmdln._help_preprocess_cmd_usage(self, help, cmdname) def do_init(self, subcmd, opts, project, package=None): """${cmd_name}: Initialize a directory as working copy