mirror of
https://github.com/OpenFreeEnergy/openfe.git
synced 2026-06-04 14:14:22 +08:00
* Initial skeleton for the CLI Currently requires the OPS CLI to be installed as well; next steps: 1. Add parameter core classes to infrastructure 2. Fully separate infrastructure into its own package * switch to using plugcli * tests for CLI * helps if you add the tests... * pep8 and deps cleanup * add test_plugins
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
# This code is part of OpenFE and is licensed under the MIT license.
|
|
# For details, see https://github.com/OpenFreeEnergy/openfe
|
|
|
|
import pathlib
|
|
|
|
import click
|
|
|
|
from plugcli.cli import CLI, CONTEXT_SETTINGS
|
|
from plugcli.plugin_management import FilePluginLoader
|
|
from .plugins import OFECommandPlugin
|
|
|
|
|
|
class OpenFECLI(CLI):
|
|
COMMAND_SECTIONS = ["Setup", "Simulation", "Orchestration", "Analysis"]
|
|
|
|
def get_installed_plugins(self):
|
|
commands = str(pathlib.Path(__file__).parent.resolve() / "commands")
|
|
loader = FilePluginLoader(commands, OFECommandPlugin)
|
|
return list(loader())
|
|
|
|
|
|
_MAIN_HELP = """
|
|
This is the command line tool to provide easy access to functionality from
|
|
the OpenFE Python library.
|
|
"""
|
|
|
|
|
|
@click.command(cls=OpenFECLI, name="openfe", help=_MAIN_HELP,
|
|
context_settings=CONTEXT_SETTINGS)
|
|
def main():
|
|
# currently empty: we can add options at the openfe level (as opposed to
|
|
# subcommands) by adding click options here. Subcommand runs after this
|
|
# is the processed.
|
|
pass
|
|
|
|
|
|
if __name__ == "__main__": # -no-cov- (useful in debugging)
|
|
main()
|