mirror of
https://github.com/certbot/certbot.git
synced 2026-08-02 19:22:16 +02:00
Add option_was_set function
This commit is contained in:
@@ -217,6 +217,21 @@ def set_by_cli(var):
|
|||||||
set_by_cli.detector = None
|
set_by_cli.detector = None
|
||||||
|
|
||||||
|
|
||||||
|
def option_was_set(option, value):
|
||||||
|
"""Was option set by the user or does it differ from the default?
|
||||||
|
|
||||||
|
:param str option: configuration variable being considered
|
||||||
|
:param value: value of the configuration variable named option
|
||||||
|
|
||||||
|
:returns: True if the option was set, otherwise, False
|
||||||
|
:rtype: bool
|
||||||
|
|
||||||
|
"""
|
||||||
|
return (set_by_cli(option) or
|
||||||
|
option not in DEFAULTS or
|
||||||
|
DEFAULTS[option] != value)
|
||||||
|
|
||||||
|
|
||||||
def argparse_type(variable):
|
def argparse_type(variable):
|
||||||
"Return our argparse type function for a config variable (default: str)"
|
"Return our argparse type function for a config variable (default: str)"
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
|
|||||||
Reference in New Issue
Block a user