# -*- coding: utf-8 -*-
from distutils.core import setup

packages = \
['clinner', 'clinner.run', 'clinner.run.commands', 'clinner.run.mixins']

package_data = \
{'': ['*']}

install_requires = \
['colorlog>=3.1,<4.0']

setup_kwargs = {
    'name': 'clinner',
    'version': '1.11.1',
    'description': 'Command Line Interface builder that helps creating an entry point for your application.',
    'long_description': '# Clinner\n[![Build Status](https://travis-ci.org/PeRDy/clinner.svg?branch=master)](https://travis-ci.org/PeRDy/clinner)\n[![codecov](https://codecov.io/gh/PeRDy/clinner/branch/master/graph/badge.svg)](https://codecov.io/gh/PeRDy/clinner)\n[![PyPI version](https://badge.fury.io/py/clinner.svg)](https://badge.fury.io/py/clinner)\n\n* **Version:** 1.11.1\n* **Status:** Production/Stable\n* **Author:** José Antonio Perdiguero López\n\nCommand Line Interface builder that helps creating an entry point for your application.\n\nCheck full [Clinner documentation].\n\n## Quick start\nInstall this package using pip:\n\n```bash\npip install clinner\n```\n\nCreate a command\n\n```python\nfrom clinner.command import command\n\n@command\ndef foo(*args, **kwargs):\n    return True\n```\n\nCreate a main file:\n\n```python\nfrom clinner.run.main import Main\n\nif __name__ == \'__main__\':\n    sys.exit(Main().run())\n```\n\n## Commands\nCommands are declared using a decorator to register given functions. Commands are functions with the follow parameters:\n\n1. `func`: Function that will be called when command would be executed.\n2. `command_type`: Type of the command, could be a *bash* or *python* command.\n3. `args`: Parser arguments for this command.\n4. `parser_opts`: Command subparser\'s keywords, such as description.\n\nThis decorator allows to be used as a common decorator without arguments, where default type (*python*) will be used:\n\n```python\n@command\ndef foobar(bar):\n    pass\n```\n\nOr specifying the type:\n\n```python\n@command(command_type=Type.PYTHON)\ndef foobar(bar):\n    pass\n```\n\nBut also is possible to provide command line arguments, as expected by argparse.ArgumentParser.add_argument:\n\n```python\n@command(args=(((\'-f\', \'--foo\'), {\'help\': \'Foo argument that does nothing\'}),                   # Command argument\n               ((\'--bar\',), {\'action\': \'store_true\', \'help\': \'Bar argument stored as True\'})),  # Another argument\n         parser_opts={\'title\': \'foobar_command\', \'help\': \'Help for foobar_command\'})            # Parser parameters\ndef foobar(*args, **kwargs):\n    pass\n```\n\nAll commands will be registered in a command register that can be accessed through ``command.register``. Each entry in\nthis register is a dictionary with the fields declared at the beginning of this section.\n\n## Main\nA main class is defined to ease the creation of command line applications. This class follows the process:\n\n1. Create a parser using ``argparse.ArgumentParser`` for the application:\n\n    a) Calling all ``add_arguments(parser)`` methods from all super classes, e.g: ``clinner.mixins.HealthCheckMixin``.\n    b) Addding a subparser for each command with their specific arguments.\n\n2. Parse arguments using the argument parser created previously.\n\n3. Inject variables into environment calling all super classes methods whose name starts with ``inject_``.\n\n4. Load settings module from **CLINNER_SETTINGS** environment variable. More details below.\n\n\n## Settings\nClinner settings can be specified through **CLINNER_SETTINGS** environment variable or using ``-s`` or ``--settings``\ncommand line flags during invocation. The format to specify settings module or class should be either ``package.module``\nor ``package.module:Class``.\n\n### Default Arguments\nDefault arguments for commands. Let a command `foo` declared:\n\n```python\ndefault_args = {\n    \'foo\': [\'-v\', \'--bar\', \'foobar\'],\n}\n```\n\n## Examples\nSome Clinner examples.\n\n### Simple Main\nExample of a simple main with two defined commands `foo` and `bar`.\n\n```python\n#!/usr/bin/env python\nimport os\nimport shlex\nimport sys\n\nfrom clinner.command import command, Type as CommandType\nfrom clinner.run.main import Main\n\n\n@command(command_type=CommandType.SHELL\n         args=((\'-i\', \'--input\'),\n               (\'-o\', \'--output\')),\n         parser_opts={\'help\': \'Foo command\'})\ndef foo(*args, **kwargs):\n    """List of foo commands"""\n    ls_cmd = shlex.split(\'ls\')\n    wc_cmd = shlex.split(\'wc\')\n    wc_cmd += [kwargs[\'input\'], kwargs[\'output\']]\n\n    return [ls_cmd, wc_cmd]\n\n\n@command(command_type=CommandType.PYTHON,\n         parser_opts={\'help\': \'Bar command\'})\ndef bar(*args, **kwargs):\n    """Do a bar."""\n    return True\n\n\nif __name__ == \'__main__\':\n    sys.exit(Main().run())\n```\n\n### Builder Main\nExample of main module with build utilities such as unit tests, lint, sphinx doc, tox and dist packaging:\n\n```python\n#!/usr/bin/env python\nimport sys\n\nfrom clinner.run import Main\n\n\nclass Build(Main):\n    commands = (\n        \'clinner.run.commands.black.black\',\n        \'clinner.run.commands.flake8.flake8\',\n        \'clinner.run.commands.isort.isort\',\n        \'clinner.run.commands.pytest.pytest\',\n        \'clinner.run.commands.sphinx.sphinx\',\n        \'clinner.run.commands.tox.tox\',\n    )\n\n\nif __name__ == \'__main__\':\n    sys.exit(Build().run())\n```\n\nCheck [Clinner documentation] to see more advanced examples.\n\n[Clinner documentation]: http://clinner.readthedocs.io\n',
    'author': 'José Antonio Perdiguero López',
    'author_email': 'perdy@perdy.io',
    'url': 'https://github.com/PeRDy/clinner',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.5,<4.0',
}


setup(**setup_kwargs)
