diff --git a/app/deploy_system.py b/app/deploy_system.py index 369fe73..7c2195a 100644 --- a/app/deploy_system.py +++ b/app/deploy_system.py @@ -31,22 +31,24 @@ def include_exclude_check(s, args): exclude_list = args.exclude.split(",") return s not in exclude_list -parser = argparse.ArgumentParser( - description="deploy the complete stack" - ) -parser.add_argument("command", type=str, nargs=1, choices=['up', 'down', 'ps'], help="command: up|down|ps") -parser.add_argument("--verbose", action="store_true", help="increase output verbosity") -parser.add_argument("--quiet", action="store_true", help="don\'t print informational output") -parser.add_argument("--check-only", action="store_true", help="looks at what\'s already there and checks if it looks good") -parser.add_argument("--dry-run", action="store_true", help="don\'t do anything, just print the commands that would be executed") -group = parser.add_mutually_exclusive_group() -group.add_argument("--exclude", type=str, help="don\'t start these components") -group.add_argument("--include", type=str, help="only start these components") +#parser = argparse.ArgumentParser( +# description="deploy the complete stack" +# ) +#parser.add_argument("command", type=str, nargs=1, choices=['up', 'down', 'ps'], help="command: up|down|ps") +#parser.add_argument("--verbose", action="store_true", help="increase output verbosity") +#parser.add_argument("--quiet", action="store_true", help="don\'t print informational output") +#parser.add_argument("--check-only", action="store_true", help="looks at what\'s already there and checks if it looks good") +#parser.add_argument("--dry-run", action="store_true", help="don\'t do anything, just print the commands that would be executed") +#group = parser.add_mutually_exclusive_group() +#group.add_argument("--exclude", type=str, help="don\'t start these components") +#group.add_argument("--include", type=str, help="only start these components") -args = parser.parse_args() +#args = parser.parse_args() -verbose = args.verbose -quiet = args.quiet +#verbose = args.verbose +#quiet = args.quiet + +#print("Yo2!") @click.command() def command(): diff --git a/orchestrator.py b/cli.py similarity index 53% rename from orchestrator.py rename to cli.py index 9212de1..47d4811 100644 --- a/orchestrator.py +++ b/cli.py @@ -15,14 +15,21 @@ import click -from .app import setup_repositories -from .app import build_containers -from .app import deploy_system +from app import setup_repositories +from app import build_containers +from app import deploy_system -@click.group() -def main_command_group(): - pass +CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) -main_command_group.add_command(setup_repositories.command) -main_command_group.add_command(build_containers.command) -main_command_group.add_command(deploy_system.command) +@click.group(context_settings=CONTEXT_SETTINGS) +@click.option('--quiet', default=False) +@click.option('--verbose', default=False) +@click.option('--dry-run', default=False) +def cli(): + """Example script.""" + print("Yo!") + click.echo('Hello World!') + +cli.add_command(setup_repositories.command,"setup-repositories") +cli.add_command(build_containers.command,"build-containers") +cli.add_command(deploy_system.command,"deploy-system") diff --git a/setup.py b/setup.py index 81bf1ba..429e9a4 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ with open("requirements.txt", "r", encoding="utf-8") as fh: requirements = fh.read() setup( name = 'laconic-stack-orchestrator', - version = '0.0.1', + version = '0.0.3', author = 'Cerc', author_email = 'info@cerc.io', license = 'GNU Affero General Public License', @@ -22,8 +22,7 @@ setup( "Programming Language :: Python :: 3.8", "Operating System :: OS Independent", ], - entry_points = ''' - [console_scripts] - laconic-stack-orchestrator=orchestrator:cli - ''' + entry_points = { + 'console_scripts': ['laconic-stack-orchestrator=cli:cli'], + } )