Remove need for summary argument
This commit is contained in:
parent
8559df502d
commit
b651deae4e
|
@ -1,16 +1,12 @@
|
||||||
from borgmanager.database.object import Repo, Archive, Cache
|
|
||||||
from math import floor, pow, log
|
from math import floor, pow, log
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
|
||||||
class Summary(object):
|
class Summary(object):
|
||||||
def __init__(self, db, args):
|
def __init__(self, db):
|
||||||
self.db = db
|
self.db = db
|
||||||
|
|
||||||
if args == "repo":
|
def repo_stats(self):
|
||||||
print(self.print_repo_stats())
|
|
||||||
|
|
||||||
def print_repo_stats(self):
|
|
||||||
repos = self.db.repo_conn.get_all()
|
repos = self.db.repo_conn.get_all()
|
||||||
|
|
||||||
return_string = ""
|
return_string = ""
|
||||||
|
|
|
@ -15,8 +15,9 @@ def main(args, path: Path):
|
||||||
path = output_path
|
path = output_path
|
||||||
db = BorgDatabase(path / 'borg.sqlite')
|
db = BorgDatabase(path / 'borg.sqlite')
|
||||||
|
|
||||||
if args.summary is not None:
|
if args.summary:
|
||||||
summary = Summary(db, args.summary)
|
summary = Summary(db)
|
||||||
|
print(summary.repo_stats())
|
||||||
else:
|
else:
|
||||||
borg_output = " ".join(stdin.readlines())
|
borg_output = " ".join(stdin.readlines())
|
||||||
if args.label is None:
|
if args.label is None:
|
||||||
|
@ -32,7 +33,7 @@ def main(args, path: Path):
|
||||||
|
|
||||||
def get_args():
|
def get_args():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("-s", "--summary", help="Print summary", type=str)
|
parser.add_argument("-s", "--summary", help="Print summary", action='store_true')
|
||||||
parser.add_argument("-d", "--dir", help="Database directory", type=str)
|
parser.add_argument("-d", "--dir", help="Database directory", type=str)
|
||||||
parser.add_argument("-l", "--label", help="Repo Label", type=str)
|
parser.add_argument("-l", "--label", help="Repo Label", type=str)
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user