2020-08-05 13:59:46 +02:00
|
|
|
#!/usr/bin/env python3
|
2020-10-05 11:08:27 +02:00
|
|
|
"""
|
|
|
|
cli/cli.py Main entry point of halfapi cli tool
|
|
|
|
|
|
|
|
The init command is the only command loaded if not in a *project dir*, and it is
|
|
|
|
not loaded otherwise.
|
|
|
|
"""
|
2020-08-05 13:59:46 +02:00
|
|
|
# builtins
|
|
|
|
import click
|
2020-10-05 11:08:27 +02:00
|
|
|
from ..conf import IS_PROJECT
|
2020-08-05 13:59:46 +02:00
|
|
|
|
|
|
|
@click.group(invoke_without_command=True)
|
|
|
|
@click.option('--version', is_flag=True)
|
|
|
|
@click.pass_context
|
|
|
|
def cli(ctx, version):
|
2020-10-05 11:08:27 +02:00
|
|
|
"""
|
|
|
|
HalfAPI Cli entry point
|
|
|
|
|
|
|
|
It uses the Click library
|
|
|
|
"""
|
2020-08-05 13:59:46 +02:00
|
|
|
if version:
|
2020-10-05 11:08:27 +02:00
|
|
|
from halfapi import version
|
2020-10-07 09:50:46 +02:00
|
|
|
click.echo(version())
|
2020-08-05 13:59:46 +02:00
|
|
|
|
|
|
|
if IS_PROJECT:
|
2020-10-07 07:01:03 +02:00
|
|
|
from . import config
|
|
|
|
from . import domain
|
|
|
|
from . import run
|
2020-08-27 11:25:20 +02:00
|
|
|
|
2020-08-05 13:59:46 +02:00
|
|
|
else:
|
2020-10-07 07:01:03 +02:00
|
|
|
from . import init
|