From 23f9c1c106348c980f70a0fc3fdbf60132f5d402 Mon Sep 17 00:00:00 2001 From: davidkastner Date: Fri, 19 Jan 2024 10:50:21 -0500 Subject: [PATCH] Improved the CLI welcome --- pyef/cli.py | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/pyef/cli.py b/pyef/cli.py index c92a372..d31e3ce 100644 --- a/pyef/cli.py +++ b/pyef/cli.py @@ -3,12 +3,37 @@ import pyef import click +def welcome(): + """Print first to welcome the user while it waits to load the modules""" + + print("\n ╔═══════════════════════════╗") + print(" ║ .-----------------------. ║") + print(" ║ | ┌──────┐ | ║") + print(" ║ | │ ┌───┘ | ║") + print(" ║ | │ └───┐ | ║") + print(" ║ | │ ┌───┘ | ║") + print(" ║ | │ ├┬┬┬┐ | ║") + print(" ║ | └──┴┴┴┴┘ | ║") + print(" ║ | | ║") + print(" ║ | WELCOME TO PYEF | ║") + print(" ║ '-----------------------' ║") + print(" ╚═══════════════════════════╝\n") + + print("Default programmed actions for the pyEF package.") + print("GitHub: https://github.com/davidkastner/pyef") + print("Documentation: https://pyef.readthedocs.io") + print("• Command for electric field analysis: pyef ef --run") + print("• Command for electrostatic analysis: pyef esp --run\n") + +# Welcome even if no flags +welcome() + @click.group() def cli(): - """pyEF Command-line Interface.""" - welcome_message() + """CLI entry point""" + pass -@click.command() +@cli.command() @click.option("--run", is_flag=True, help="Analyze electric fields.") def ef(run): """Analyzes electric fields""" @@ -26,7 +51,7 @@ def ef(run): metal_indices = [int(metal.strip()) for metal in metal_indices.split(",")] pyef.run.main(jobs, geom_flag, esp_flag, metal_indices) -@click.command() +@cli.command() @click.option("--run", is_flag=True, help="Perform an action") def esp(run): """Analyzes electrostatic potential""" @@ -43,18 +68,5 @@ def esp(run): metal_indices = [int(metal.strip()) for metal in metal_indices.split(",")] pyef.run.main(jobs, geom_flag, esp_flag, metal_indices) -def welcome_message(): - print("\n.-------------------------.") - print("| WELCOME TO THE pyEF CLI |") - print(".-------------------------.") - print("Default programmed actions for the pyEF package.") - print("GitHub: https://github.com/davidkastner/pyef") - print("Documentation: https://pyef.readthedocs.io") - print("Command for electric field analysis: pyef ef --run") - print("Command for electrostatic analysis: pyef esp --run\n") - -cli.add_command(ef) -cli.add_command(esp) - if __name__ == '__main__': cli()