MCPcopy
hub / github.com/certbot/certbot / _add

Method _add

certbot/src/certbot/_internal/cli/helpful.py:419–448  ·  view source on GitHub ↗
(self, topics: Optional[Union[list[Optional[str]], str]], *args: Any,
            **kwargs: Any)

Source from the content-addressed store, hash-verified

417 self.actions.append(self._add(topics, *args, **kwargs))
418
419 def _add(self, topics: Optional[Union[list[Optional[str]], str]], *args: Any,
420 **kwargs: Any) -> configargparse.Action:
421 action = kwargs.get("action")
422 if action is util.DeprecatedArgumentAction:
423 # If the argument is deprecated through
424 # certbot.util.add_deprecated_argument, it is not shown in the help
425 # output and any value given to the argument is thrown away during
426 # argument parsing. Because of this, we handle this case early
427 # skipping putting the argument in different help topics and
428 # handling default detection since these actions aren't needed and
429 # can cause bugs like
430 # https://github.com/certbot/certbot/issues/8495.
431 return self.parser.add_argument(*args, **kwargs)
432
433 if isinstance(topics, list):
434 # if this flag can be listed in multiple sections, try to pick the one
435 # that the user has asked for help about
436 topic = self.help_arg if self.help_arg in topics else topics[0]
437 else:
438 topic = topics # there's only one
439
440 if not isinstance(topic, bool) and self.visible_topics[topic]:
441 if topic in self.groups:
442 group = self.groups[topic]
443 return group.add_argument(*args, **kwargs)
444 else:
445 return self.parser.add_argument(*args, **kwargs)
446 else:
447 kwargs["help"] = argparse.SUPPRESS
448 return self.parser.add_argument(*args, **kwargs)
449
450 def add_deprecated_argument(self, argument_name: str, num_args: int) -> None:
451 """Adds a deprecated argument with the name argument_name.

Callers 1

addMethod · 0.95

Calls 2

add_argumentMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected