def activate(self): """The Yapsy plugin system calls this to setup the plugin. In this case that includes: - Adding the command's sub-command arguments to the general pavilion argument parser. - Running the _setup_other method. - Adding the command to Pavilion's known commands. """ # Add the arguments for this command to the sub_parser = arguments.get_subparser() # A add the short help, or not. A quirk of argparse is that if 'help' # is set, the subcommand is listed regardless of whether the # help is None. If we don't want that, we have to init without 'help'. if self.short_help is None: parser = sub_parser.add_parser(self.name, aliases=self.aliases, description=self.description) else: parser = sub_parser.add_parser(self.name, aliases=self.aliases, description=self.description, help=self.short_help) self._setup_arguments(parser) self._setup_other() add_command(self)
def activate(self): # Add the arguments for this command to the sub_parser = arguments.get_subparser() parser = sub_parser.add_parser(self.name, description=self.description) self._setup_arguments(parser) self._setup_other() add_command(self)
def activate(self): # Add the arguments for this command to the sub_parser = arguments.get_subparser() # A add the short help, or not. A quirk of argparse is that if 'help' # is set, the subcommand is listed regardless of whether the # help is None. If we don't want that, we have to init without 'help'. if self.short_help is None: parser = sub_parser.add_parser(self.name, aliases=self._aliases, description=self.description) else: parser = sub_parser.add_parser(self.name, aliases=self._aliases, description=self.description, help=self.short_help) self._setup_arguments(parser) self._setup_other() add_command(self)