put more cli
This commit is contained in:
parent
daab486f7b
commit
975501635a
3 changed files with 22 additions and 6 deletions
|
@ -3,6 +3,7 @@ import typer
|
||||||
from corrlib import __app_name__, __version__
|
from corrlib import __app_name__, __version__
|
||||||
from .initialization import create
|
from .initialization import create
|
||||||
from .toml import import_toml
|
from .toml import import_toml
|
||||||
|
from .find import find_record
|
||||||
app = typer.Typer()
|
app = typer.Typer()
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,13 +13,26 @@ def _version_callback(value: bool) -> None:
|
||||||
raise typer.Exit()
|
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()
|
@app.command()
|
||||||
def importer(
|
def importer(
|
||||||
path: str = typer.Option(
|
path: str = typer.Option(
|
||||||
str('./corrlib'),
|
str('./corrlib'),
|
||||||
"--dataset",
|
"--dataset",
|
||||||
"-d",
|
"-d",
|
||||||
prompt="Which corrlib instance?"
|
|
||||||
),
|
),
|
||||||
file: str = typer.Argument(
|
file: str = typer.Argument(
|
||||||
),
|
),
|
||||||
|
@ -26,9 +40,11 @@ def importer(
|
||||||
bool(True),
|
bool(True),
|
||||||
"--save",
|
"--save",
|
||||||
"-s",
|
"-s",
|
||||||
prompt="Copy config file?",
|
|
||||||
),
|
),
|
||||||
) -> None:
|
) -> None:
|
||||||
|
"""
|
||||||
|
Import a project from a .toml-file via CLI.
|
||||||
|
"""
|
||||||
import_toml(path, file, copy_file)
|
import_toml(path, file, copy_file)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -39,9 +55,11 @@ def init(
|
||||||
str('./corrlib'),
|
str('./corrlib'),
|
||||||
"--dataset",
|
"--dataset",
|
||||||
"-d",
|
"-d",
|
||||||
prompt="Dataset location?",
|
|
||||||
),
|
),
|
||||||
) -> None:
|
) -> None:
|
||||||
|
"""
|
||||||
|
Initialize a new backlog-database.
|
||||||
|
"""
|
||||||
create(path)
|
create(path)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ import os
|
||||||
|
|
||||||
|
|
||||||
def check_project_data(d):
|
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:
|
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"!')
|
raise ValueError('There should only be two key on the top level, "project" and "measurements"!')
|
||||||
project_data = d['project']
|
project_data = d['project']
|
||||||
|
@ -49,7 +48,6 @@ def import_toml(path, file, copy_file=True):
|
||||||
project = toml_dict['project']
|
project = toml_dict['project']
|
||||||
measurements = toml_dict['measurements']
|
measurements = toml_dict['measurements']
|
||||||
uuid = import_project(path, project['url'])
|
uuid = import_project(path, project['url'])
|
||||||
print(measurements.items())
|
|
||||||
for mname, md in measurements.items():
|
for mname, md in measurements.items():
|
||||||
print("Import measurement: " + mname)
|
print("Import measurement: " + mname)
|
||||||
ensemble = md['ensemble']
|
ensemble = md['ensemble']
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue