Feat: report a csv file, a directory or all

This commit is contained in:
Bertrand Benjamin 2019-09-24 15:41:57 +02:00
parent 7a0bb4179d
commit 6fb11cb054

View File

@ -55,18 +55,25 @@ def reporting(csv_file):
)
@cli.command()
@click.argument("csv_file", required=False)
def report(csv_file=""):
if csv_file:
csv = Path(csv_file)
@click.argument("target", required=False)
def report(target=""):
""" Make a report for the eval
:param target: csv file or a directory where csvs are
"""
try:
if target.endswith(".csv"):
csv = Path(target)
if not csv.exists():
click.echo(f"{csv_file} does not exists")
click.echo(f"{target} does not exists")
sys.exit(1)
if csv.suffix != ".csv":
click.echo(f"{csv_file} has to be a csv file")
click.echo(f"{target} has to be a csv file")
sys.exit(1)
csvs = [csv]
else:
csvs = list(Path(target).glob('**/*.csv'))
except AttributeError:
csvs = list(Path(config["source"]).glob('**/*.csv'))
for csv in csvs: