From a17f98520334edb65407e4c800091b067ae50e18 Mon Sep 17 00:00:00 2001 From: Ana Trisovic Date: Tue, 24 Jul 2018 11:43:48 +0200 Subject: [PATCH] cli: upload multiple files closes: #79 Signed-off-by: Ana Trisovic --- cap_client/cli/files_cli.py | 12 +++++++----- docs/index.rst | 12 ++++++++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/cap_client/cli/files_cli.py b/cap_client/cli/files_cli.py index 7f83aed..1ba856c 100644 --- a/cap_client/cli/files_cli.py +++ b/cap_client/cli/files_cli.py @@ -45,7 +45,7 @@ def files(): default=None, required=True ) -@click.argument('file', type=click.Path(exists=False)) +@click.argument('file', type=click.Path(exists=False), nargs=-1) @click.option( '--output-file', '-o', @@ -69,11 +69,13 @@ def upload(ctx, pid, file, yes, output_file=None, docker=False): if docker: ctx.obj.cap_api.upload_docker_img(pid=pid, img_name=file, output_img_name=output_file) + click.echo("Docker image uploaded successfully.") else: - ctx.obj.cap_api.upload_file( - pid=pid, filepath=file, - output_filename=output_file, yes=yes) - click.echo("File uploaded successfully.") + for _file in file: + ctx.obj.cap_api.upload_file( + pid=pid, filepath=_file, + output_filename=output_file, yes=yes) + click.echo(_file + " uploaded successfully.") except BadStatusCode as e: logging.error(str(e)) diff --git a/docs/index.rst b/docs/index.rst index eb26970..f0c7391 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -554,7 +554,7 @@ You need to specify Upload file ----------- -You can upload a file to an analysis only if you have at least read access to it. +You can upload a file (or multiple files) to an analysis only if you have at least read access to it. You need to specify @@ -566,7 +566,15 @@ You need to specify $ cap-client files upload file.json -p 89b593c498874ec8bcafc88944c458a7 - File uploaded successfully. + file.json uploaded successfully. + + $ cap-client files upload config.txt history.txt dict.json -p bf6b8501822c4d2ba46028611354df7e + + config.txt uploaded successfully. + + history.txt uploaded successfully. + + dict.json uploaded successfully. Upload Docker image