Move output handler to borg package

This commit is contained in:
George Lacey 2021-05-04 12:53:42 +01:00
parent b49be0c0ba
commit 3b7405fe9c
3 changed files with 4 additions and 3 deletions

View File

@ -2,3 +2,4 @@ from .repo import Repo
from .archive import Archive from .archive import Archive
from .stats import Stats from .stats import Stats
from .error import Error from .error import Error
from .outputhandler import OutputHandler

View File

@ -3,7 +3,7 @@ from borgmanager import borg
import json import json
class BorgOutputHandler(object): class OutputHandler(object):
def __init__(self, borg_output: str): def __init__(self, borg_output: str):
self.borg_output = borg_output self.borg_output = borg_output
self.borg_json = None self.borg_json = None

View File

@ -3,7 +3,7 @@ from sys import stdin
from os.path import realpath from os.path import realpath
from pathlib import Path from pathlib import Path
import argparse import argparse
from borgoutputhandler import BorgOutputHandler from borgmanager.borg import OutputHandler
from borgmanager.summary import Summary from borgmanager.summary import Summary
@ -15,7 +15,7 @@ def main(args, path: Path):
summary = Summary(db, args.summary) summary = Summary(db, args.summary)
else: else:
borg_output = " ".join(stdin.readlines()) borg_output = " ".join(stdin.readlines())
bo = BorgOutputHandler(borg_output) bo = OutputHandler(borg_output)
if bo.error: if bo.error:
db.insert_error(bo.get_borg_error()) db.insert_error(bo.get_borg_error())