MCPcopy
hub / github.com/certbot/certbot / prepare_and_parse_args

Function prepare_and_parse_args

certbot/src/certbot/_internal/cli/__init__.py:59–499  ·  view source on GitHub ↗

Returns parsed command line arguments. :param .PluginsRegistry plugins: available plugins :param list args: command line arguments with the program name removed :returns: parsed command line arguments :rtype: configuration.NamespaceConfig

(plugins: plugins_disco.PluginsRegistry, args: list[str]
                           )

Source from the content-addressed store, hash-verified

57
58
59def prepare_and_parse_args(plugins: plugins_disco.PluginsRegistry, args: list[str]
60 ) -> NamespaceConfig:
61 """Returns parsed command line arguments.
62
63 :param .PluginsRegistry plugins: available plugins
64 :param list args: command line arguments with the program name removed
65
66 :returns: parsed command line arguments
67 :rtype: configuration.NamespaceConfig
68
69 """
70
71 helpful = HelpfulArgumentParser(args, plugins)
72 _add_all_groups(helpful)
73
74 # --help is automatically provided by argparse
75 helpful.add(
76 None, "-v", "--verbose", dest="verbose_count", action="count",
77 default=flag_default("verbose_count"), help="This flag can be used "
78 "multiple times to incrementally increase the verbosity of output, "
79 "e.g. -vvv.")
80 # This is for developers to set the level in the cli.ini, and overrides
81 # the --verbose flag
82 helpful.add(
83 None, "--verbose-level", dest="verbose_level",
84 default=flag_default("verbose_level"), help=argparse.SUPPRESS)
85 helpful.add(
86 None, "-t", "--text", dest="text_mode", action="store_true",
87 default=flag_default("text_mode"), help=argparse.SUPPRESS)
88 helpful.add(
89 None, "--max-log-backups", type=nonnegative_int,
90 default=flag_default("max_log_backups"),
91 help="Specifies the maximum number of backup logs that should "
92 "be kept by Certbot's built in log rotation. Setting this "
93 "flag to 0 disables log rotation entirely, causing "
94 "Certbot to always append to the same log file.")
95 helpful.add(
96 None, "--preconfigured-renewal", dest="preconfigured_renewal",
97 action="store_true", default=flag_default("preconfigured_renewal"),
98 help=argparse.SUPPRESS
99 )
100 helpful.add(
101 [None, "automation", "run", "certonly", "enhance"],
102 "-n", "--non-interactive", "--noninteractive",
103 dest="noninteractive_mode", action="store_true",
104 default=flag_default("noninteractive_mode"),
105 help="Run without ever asking for user input. This may require "
106 "additional command line flags; the client will try to explain "
107 "which ones are required if it finds one missing")
108 helpful.add(
109 [None, "register", "run", "certonly", "enhance"],
110 constants.FORCE_INTERACTIVE_FLAG, action="store_true",
111 default=flag_default("force_interactive"),
112 help="Force Certbot to be interactive even if it detects it's not "
113 "being run in a terminal. This flag cannot be used with the "
114 "renew subcommand.")
115 helpful.add(
116 [None, "run", "certonly", "certificates", "enhance"],

Callers

nothing calls this directly

Calls 11

addMethod · 0.95
parse_argsMethod · 0.95
_add_all_groupsFunction · 0.90
flag_defaultFunction · 0.90
config_helpFunction · 0.90
_create_subparsersFunction · 0.90
_paths_parserFunction · 0.90
_plugins_parsingFunction · 0.90
formatMethod · 0.80

Tested by

no test coverage detected