From 975501635a5af09aec6db30e98a19dd514f762c9 Mon Sep 17 00:00:00 2001 From: Justus Kuhlmann Date: Mon, 26 Aug 2024 12:48:51 +0000 Subject: [PATCH] put more cli --- corrlib/cli.py | 24 +++++++++++++++++++++--- corrlib/toml.py | 2 -- corrlib/version.py | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/corrlib/cli.py b/corrlib/cli.py index 6dcd3ad..59bdc78 100644 --- a/corrlib/cli.py +++ b/corrlib/cli.py @@ -3,6 +3,7 @@ import typer from corrlib import __app_name__, __version__ from .initialization import create from .toml import import_toml +from .find import find_record app = typer.Typer() @@ -12,13 +13,26 @@ def _version_callback(value: bool) -> None: raise typer.Exit() +@app.command() +def find( + path: str = typer.Option( + str('./corrlib'), + "--dataset", + "-d", + ), + ensemble: str = typer.Argument(), + corr: str = typer.Argument(), +) -> None: + results = find_record(path, ensemble, corr) + print(results) + + @app.command() def importer( path: str = typer.Option( str('./corrlib'), "--dataset", "-d", - prompt="Which corrlib instance?" ), file: str = typer.Argument( ), @@ -26,9 +40,11 @@ def importer( bool(True), "--save", "-s", - prompt="Copy config file?", ), ) -> None: + """ + Import a project from a .toml-file via CLI. + """ import_toml(path, file, copy_file) return @@ -39,9 +55,11 @@ def init( str('./corrlib'), "--dataset", "-d", - prompt="Dataset location?", ), ) -> None: + """ + Initialize a new backlog-database. + """ create(path) return diff --git a/corrlib/toml.py b/corrlib/toml.py index 12cc7b2..2e8bdc0 100644 --- a/corrlib/toml.py +++ b/corrlib/toml.py @@ -18,7 +18,6 @@ import os def check_project_data(d): - print(d.keys()) if 'project' not in d.keys() or 'measurements' not in d.keys() or len(list(d.keys())) > 2: raise ValueError('There should only be two key on the top level, "project" and "measurements"!') project_data = d['project'] @@ -49,7 +48,6 @@ def import_toml(path, file, copy_file=True): project = toml_dict['project'] measurements = toml_dict['measurements'] uuid = import_project(path, project['url']) - print(measurements.items()) for mname, md in measurements.items(): print("Import measurement: " + mname) ensemble = md['ensemble'] diff --git a/corrlib/version.py b/corrlib/version.py index a0235ce..3b93d0b 100644 --- a/corrlib/version.py +++ b/corrlib/version.py @@ -1 +1 @@ -__version__ = "0.0.2" \ No newline at end of file +__version__ = "0.0.2"