# -*- coding: utf-8; mode: python; -*-
"""
${name} commands
"""

import sys

from rattail import commands

from ${pkg_name} import __version__


def main(*args):
    """
    Main entry point for ${name} command system
    """
    args = list(args or sys.argv[1:])
    cmd = Command()
    cmd.run(*args)


class Command(commands.Command):
    """
    Main command for ${name}
    """
    name = '${pkg_name}'
    version = __version__
    description = "${name} (custom Rattail system)"
    long_description = ''


class HelloWorld(commands.Subcommand):
    """
    The requisite 'hello world' example
    """
    name = 'hello'
    description = __doc__.strip()

    def run(self, args):
        self.rprint("\n\t[blue]Welcome to ${name} {}![/blue]\n".format(__version__))


class Install(commands.InstallSubcommand):
    """
    Install the ${name} app
    """
    name = 'install'
    description = __doc__.strip()

    # nb. these must be explicitly set b/c config is not available
    # when running normally, e.g. `${pkg_name} -n install`
    app_title = "${name}"
    app_package = '${pkg_name}'
    app_eggname = '${egg_name}'
    app_pypiname = '${pypi_name}'
