mirror of
https://github.com/certbot/certbot.git
synced 2026-06-08 08:12:15 -04:00
Add option_was_set function
This commit is contained in:
parent
9f61424e26
commit
8f68663097
1 changed files with 15 additions and 0 deletions
|
|
@ -217,6 +217,21 @@ def set_by_cli(var):
|
|||
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):
|
||||
"Return our argparse type function for a config variable (default: str)"
|
||||
# pylint: disable=protected-access
|
||||
|
|
|
|||
Loading…
Reference in a new issue