Fix click integration
This commit is contained in:
parent
fbf9d17a64
commit
c9d42886d5
@ -31,22 +31,24 @@ def include_exclude_check(s, args):
|
|||||||
exclude_list = args.exclude.split(",")
|
exclude_list = args.exclude.split(",")
|
||||||
return s not in exclude_list
|
return s not in exclude_list
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
#parser = argparse.ArgumentParser(
|
||||||
description="deploy the complete stack"
|
# 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("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("--verbose", action="store_true", help="increase output verbosity")
|
||||||
parser.add_argument("--quiet", action="store_true", help="don\'t print informational output")
|
#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("--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")
|
#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 = parser.add_mutually_exclusive_group()
|
||||||
group.add_argument("--exclude", type=str, help="don\'t start these components")
|
#group.add_argument("--exclude", type=str, help="don\'t start these components")
|
||||||
group.add_argument("--include", type=str, help="only 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
|
#verbose = args.verbose
|
||||||
quiet = args.quiet
|
#quiet = args.quiet
|
||||||
|
|
||||||
|
#print("Yo2!")
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
def command():
|
def command():
|
||||||
|
@ -15,14 +15,21 @@
|
|||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
from .app import setup_repositories
|
from app import setup_repositories
|
||||||
from .app import build_containers
|
from app import build_containers
|
||||||
from .app import deploy_system
|
from app import deploy_system
|
||||||
|
|
||||||
@click.group()
|
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
|
||||||
def main_command_group():
|
|
||||||
pass
|
|
||||||
|
|
||||||
main_command_group.add_command(setup_repositories.command)
|
@click.group(context_settings=CONTEXT_SETTINGS)
|
||||||
main_command_group.add_command(build_containers.command)
|
@click.option('--quiet', default=False)
|
||||||
main_command_group.add_command(deploy_system.command)
|
@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")
|
9
setup.py
9
setup.py
@ -6,7 +6,7 @@ with open("requirements.txt", "r", encoding="utf-8") as fh:
|
|||||||
requirements = fh.read()
|
requirements = fh.read()
|
||||||
setup(
|
setup(
|
||||||
name = 'laconic-stack-orchestrator',
|
name = 'laconic-stack-orchestrator',
|
||||||
version = '0.0.1',
|
version = '0.0.3',
|
||||||
author = 'Cerc',
|
author = 'Cerc',
|
||||||
author_email = 'info@cerc.io',
|
author_email = 'info@cerc.io',
|
||||||
license = 'GNU Affero General Public License',
|
license = 'GNU Affero General Public License',
|
||||||
@ -22,8 +22,7 @@ setup(
|
|||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
"Operating System :: OS Independent",
|
"Operating System :: OS Independent",
|
||||||
],
|
],
|
||||||
entry_points = '''
|
entry_points = {
|
||||||
[console_scripts]
|
'console_scripts': ['laconic-stack-orchestrator=cli:cli'],
|
||||||
laconic-stack-orchestrator=orchestrator:cli
|
}
|
||||||
'''
|
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user