Refactoring
This commit is contained in:
@@ -386,8 +386,8 @@ def update_config(path, apply_update=True):
|
||||
if value != new_config.get(section, option, raw=True):
|
||||
update = True
|
||||
new_config.set(section, option, value)
|
||||
|
||||
if update and apply_update:
|
||||
if apply_update:
|
||||
if update:
|
||||
# Backing up old config file
|
||||
date = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
|
||||
dest = f"{os.path.splitext(path)[0]}_{date}.old"
|
||||
@@ -404,14 +404,13 @@ def update_config(path, apply_update=True):
|
||||
os.chmod(dest, stat.S_IRUSR | stat.S_IWUSR)
|
||||
|
||||
return dest
|
||||
elif update and not apply_update:
|
||||
return None
|
||||
else:
|
||||
if update:
|
||||
# Simply check if current config file is outdated
|
||||
return True
|
||||
elif not update and not apply_update:
|
||||
return False
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def gen_config(dest, interactive=False):
|
||||
"""Create config file from dict template"""
|
||||
|
||||
Reference in New Issue
Block a user