From cce6adc6f69274d69c63cc36c2b4aa042a9fd6ec Mon Sep 17 00:00:00 2001 From: Freezed <2160318-free_zed@users.noreply.gitlab.com> Date: Mon, 28 Mar 2022 23:51:16 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20WIP:=20update=20creat=20from=20f?= =?UTF-8?q?ile=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cli/commands.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cli/commands.py b/cli/commands.py index 3dde278..09fa5fd 100644 --- a/cli/commands.py +++ b/cli/commands.py @@ -81,13 +81,14 @@ def _as_table(upload_result): "errors": format_error, } - basic_data = [{"key": format_property(k), "value": v} for k, v in apply_formatters(upload_result, formatters).items()] + basic_data = [ + {"key": format_property(k), "value": v} + for k, v in apply_formatters(upload_result, formatters).items() + ] return [*basic_data] - -""" @click.option("-a", "--activity_type", type=str, help="Type of activity",) @click.option("-c", "--commute", type=int, default="0", help="Set to 1 to mark as commute",) @click.option("-d", "--desc", type=str, default=DEFAULT_DESC, help="Description of the activity",) @@ -98,11 +99,12 @@ def _as_table(upload_result): # @click.option("-t", "--time", type=int, required=True, help="In seconds",) @click.option("-T", "--trainer", type=int, default="0", help="Set to 1 to mark as a trainer activity",) @output_option() -""" -@click.argument('gpx_filename', type=click.Path(exists=True)) +@click.argument("gpx_filename", type=click.Path(exists=True)) @click.command("fcreate") @login_required -def post_create_file(gpx_filename): +def post_create_file(**kwargs): """Create an manual activity from a GPX file.""" - click.echo(f"Processing: {click.format_filename(gpx_filename)}") - click.echo(f"Summary: {gpx.run([gpx_filename])}") + click.echo(f"Processing: {click.format_filename(kwargs['gpx_filename'])}") + click.echo(gpx.run([kwargs.pop("gpx_filename")])) + + post_create_manu(**kwargs) -- GitLab