Feat: report a csv file, a directory or all
This commit is contained in:
parent
7a0bb4179d
commit
6fb11cb054
@ -55,18 +55,25 @@ def reporting(csv_file):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
@click.argument("csv_file", required=False)
|
@click.argument("target", required=False)
|
||||||
def report(csv_file=""):
|
def report(target=""):
|
||||||
if csv_file:
|
""" Make a report for the eval
|
||||||
csv = Path(csv_file)
|
|
||||||
if not csv.exists():
|
:param target: csv file or a directory where csvs are
|
||||||
click.echo(f"{csv_file} does not exists")
|
"""
|
||||||
sys.exit(1)
|
try:
|
||||||
if csv.suffix != ".csv":
|
if target.endswith(".csv"):
|
||||||
click.echo(f"{csv_file} has to be a csv file")
|
csv = Path(target)
|
||||||
sys.exit(1)
|
if not csv.exists():
|
||||||
csvs = [csv]
|
click.echo(f"{target} does not exists")
|
||||||
else:
|
sys.exit(1)
|
||||||
|
if csv.suffix != ".csv":
|
||||||
|
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'))
|
csvs = list(Path(config["source"]).glob('**/*.csv'))
|
||||||
|
|
||||||
for csv in csvs:
|
for csv in csvs:
|
||||||
|
Loading…
Reference in New Issue
Block a user