halfapi/halfapi/cli/cli.py

32 lines
646 B
Python
Raw Normal View History

#!/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.
"""
# builtins
import click
2020-10-05 11:08:27 +02:00
from ..conf import IS_PROJECT
@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
"""
if version:
2020-10-05 11:08:27 +02:00
from halfapi import version
return click.echo(version())
if IS_PROJECT:
from . import config
from . import domain
from . import run
else:
from . import init