diff --git a/recopytex/scripts/recopytex.py b/recopytex/scripts/recopytex.py index dbfa045..fc8ab11 100644 --- a/recopytex/scripts/recopytex.py +++ b/recopytex/scripts/recopytex.py @@ -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) - if not csv.exists(): - click.echo(f"{csv_file} does not exists") - sys.exit(1) - if csv.suffix != ".csv": - click.echo(f"{csv_file} has to be a csv file") - sys.exit(1) - csvs = [csv] - else: +@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"{target} does not exists") + 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')) for csv in csvs: