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
37 lines
914 B
Python
37 lines
914 B
Python
# THIS IS A TEMPORARY FILE TO ILLUSTRATE HOW ONE WRITES A SUBCOMMAND PLUGIN.
|
|
# DELETE ONCE WE HAVE A FEW REAL EXAMPLES!
|
|
|
|
import click
|
|
from openfecli import OFECommandPlugin
|
|
|
|
|
|
@click.command(
|
|
"echo",
|
|
short_help="This shows up in ``openfe --help``"
|
|
)
|
|
def echo():
|
|
"""
|
|
This is the longer help statement that shows up when you get help for an
|
|
individual command, e.g., with ``openfe echo --help``.
|
|
"""
|
|
# the code here serves to convert user input to objects that would be
|
|
# run by library code. In general, this should be done with a ``get``
|
|
# method attached to the input decorators
|
|
echo_main()
|
|
|
|
|
|
def echo_main():
|
|
# the code here does the actual workflow in the library. This will tend
|
|
# to be a very small code
|
|
print("foo")
|
|
|
|
|
|
PLUGIN = OFECommandPlugin(
|
|
command=echo,
|
|
section="Simulation",
|
|
requires_ofe=(0, 0, 1)
|
|
)
|
|
|
|
if __name__ == "__main__":
|
|
echo()
|