Replace corporal commands with typer equivalents
This commit is contained in:
parent
5ff8802061
commit
226c8750a3
|
@ -1,43 +1,33 @@
|
|||
# -*- coding: utf-8; -*-
|
||||
"""
|
||||
Corporal commands
|
||||
"""
|
||||
|
||||
import sys
|
||||
import typer
|
||||
|
||||
from rattail import commands
|
||||
|
||||
from corporal import __version__
|
||||
from rattail.commands.typer import typer_callback
|
||||
|
||||
|
||||
def main(*args):
|
||||
"""
|
||||
Main entry point for Corporal command system
|
||||
"""
|
||||
args = list(args or sys.argv[1:])
|
||||
cmd = Command()
|
||||
cmd.run(*args)
|
||||
# nb. this is the top-level command for corporal
|
||||
corporal_typer = typer.Typer(
|
||||
callback=typer_callback,
|
||||
help="Corporal (custom Rattail system)"
|
||||
)
|
||||
|
||||
|
||||
class Command(commands.Command):
|
||||
"""
|
||||
Main command for Corporal
|
||||
"""
|
||||
name = 'corporal'
|
||||
version = __version__
|
||||
description = "Corporal (custom Rattail system)"
|
||||
long_description = ''
|
||||
|
||||
|
||||
class Install(commands.InstallSubcommand):
|
||||
@corporal_typer.command()
|
||||
def install(
|
||||
ctx: typer.Context,
|
||||
):
|
||||
"""
|
||||
Install the Corporal app
|
||||
"""
|
||||
name = 'install'
|
||||
description = __doc__.strip()
|
||||
from rattail.install import InstallHandler
|
||||
|
||||
# nb. these must be explicitly set b/c config is not available
|
||||
# when running normally, e.g. `corporal -n install`
|
||||
app_title = "Corporal"
|
||||
app_package = 'corporal'
|
||||
app_eggname = 'Corporal'
|
||||
app_pypiname = 'Corporal'
|
||||
config = ctx.parent.rattail_config
|
||||
handler = InstallHandler(config,
|
||||
app_title="Corporal",
|
||||
app_package='corporal',
|
||||
app_eggname='Corporal',
|
||||
app_pypiname='Corporal')
|
||||
handler.run()
|
||||
|
|
Loading…
Reference in a new issue