diff --git a/pyproject.toml b/pyproject.toml index 777485c..01e2d0d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,7 +49,7 @@ test = [ "Homepage" = "https://github.com/OpenFreeEnergy/openfe_analysis" [project.scripts] -openfe_analysis = "openfe_analysis.cli:main" +openfe_analysis = "openfe_analysis.cli:cli" [tool.versioningit] default-version = "1+unknown" diff --git a/src/openfe_analysis/cli.py b/src/openfe_analysis/cli.py index fb39f9d..42826cc 100644 --- a/src/openfe_analysis/cli.py +++ b/src/openfe_analysis/cli.py @@ -5,15 +5,25 @@ from . import rmsd -@click.command +@click.group() +def cli(): + pass + + +@cli.command(name="RFE_analysis") @click.argument('loc', type=click.Path(exists=True, readable=True, file_okay=False, dir_okay=True, path_type=pathlib.Path)) -def main(loc): +@click.argument('output', type=click.Path(writable=True, + dir_okay=False, + path_type=pathlib.Path)) +def rfe_analysis(loc, output): pdb = loc / "hybrid_system.pdb" trj = loc / "simulation.nc" data = rmsd.gather_rms_data(pdb, trj) - click.echo(json.dumps(data)) + + with click.open_file(output, 'w') as f: + f.write(json.dumps(data))