Skip to content

Commit

Permalink
fix save config and update print messages
Browse files Browse the repository at this point in the history
  • Loading branch information
elesiuta committed Oct 15, 2019
1 parent 8703357 commit 8f50538
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backupy.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(self, config: dict):
self.archive_dir = ".backupy"
self.config_dir = ".backupy"
self.cleanup = True
self.filter_list_test = [re.compile(x) for x in [r'.+', r'^[a-z]+$', r'^\d+$']]
self.filter_list_test = "[re.compile(x) for x in [r'.+', r'^[a-z]+$', r'^\d+$']]"
self.backup_time_override = False
self.csv = True
self.load_json = True
Expand Down Expand Up @@ -277,6 +277,8 @@ def __init__(self, args):
def saveJson(self):
self.config.save, self.config.load = False, False
writeJson(os.path.join(self.config.source, self.config.config_dir, "config.json"), vars(self.config))
print("Config saved")
sys.exit()

def loadJson(self):
config = readJson(os.path.join(self.config.source, self.config.config_dir, "config.json"))
Expand Down Expand Up @@ -446,6 +448,7 @@ def backup(self):
self.log.append("Aborted")
if self.config.csv:
self.writeLog()
print("Run aborted")
return 1
# Backup operations
self.log.append("Start " + self.config.m)
Expand Down Expand Up @@ -473,6 +476,7 @@ def backup(self):
self.log.append("Completed")
if self.config.csv:
self.writeLog()
print("Completed!")


def main():
Expand Down Expand Up @@ -530,7 +534,6 @@ def main():
args = parser.parse_args()
backup_manager = BackupManager(args)
backup_manager.backup()
print("Backup complete!")

if __name__ == "__main__":
sys.exit(main())
Expand Down

0 comments on commit 8f50538

Please sign in to comment.