put more cli

This commit is contained in:
Justus Kuhlmann 2024-08-26 12:48:51 +00:00
parent daab486f7b
commit 975501635a
3 changed files with 22 additions and 6 deletions

View file

@ -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

View file

@ -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']

View file

@ -1 +1 @@
__version__ = "0.0.2"
__version__ = "0.0.2"