<commit_before>battalion
=========

.. image:: https://pypip.in/py_versions/battalion/badge.svg?style=flat
        :target: https://pypi.python.org/pypi/battalion/

.. image:: https://pypip.in/license/battalion/badge.svg?style=flat
        :target: https://pypi.python.org/pypi/battalion/

.. image:: https://pypip.in/download/battalion/badge.svg?style=flat
        :target: https://pypi.python.org/pypi/battalion/

.. image:: https://pypip.in/version/battalion/badge.svg?style=flat
        :target: https://pypi.python.org/pypi/battalion/

.. image:: https://pypip.in/wheel/battalion/badge.svg?style=flat
        :target: https://pypi.python.org/pypi/battalion/

.. image:: https://requires.io/github/rocktavious/battalion/requirements.png?branch=master
        :target: https://requires.io/github/rocktavious/battalion/requirements/?branch=master
        :alt: Requirements Status

Python framework for commandline applications

Quickstart
----------

Feeling impatient? I like your style.

.. code-block:: bash

    $ pip install battalion

In mycli.py script:

.. code-block:: python

    from battalion.api import *

    class DB(object):
        
        def __init__(self, state):
            self.msg = state.git_msg
    
        def myfunc(self):
            print self.msg
    
    @fixture
    def db(state):
        return DB(state)
    
    class mycli(CLI):    
        """
        Toplevel program - mycli
        """
        class State:
            version = '0.0.1'
            msg = ""
        
        def normal_function(self, db, data):
            """Takes in data and outputs new data"""
            if data is None:
                return db.myfunc()
            else:
                return data
        
        @command
        def greeting(cli, name="Hello"):
            """
            Prints "Hello {name}!"
            """
            print "Hello {0}!".format(name)

    class myhandler(Handler):
        """
        Organizational container of commands which can also add state variables
        """
        class State:
            version = '0.0.2'  # Handlers can have their own versioning
            cli = 'mycli'
            msg = "World"

        @command
        def validate(cli, data):
            return data
        
        @command
        def hello(cli, msg=None):<commit_msg>readme updates<commit_after>battalion
=========

.. image:: https://pypip.in/py_versions/battalion/badge.svg?style=flat
        :target: https://pypi.python.org/pypi/battalion/

.. image:: https://pypip.in/license/battalion/badge.svg?style=flat
        :target: https://pypi.python.org/pypi/battalion/

.. image:: https://pypip.in/download/battalion/badge.svg?style=flat
        :target: https://pypi.python.org/pypi/battalion/

.. image:: https://pypip.in/version/battalion/badge.svg?style=flat
        :target: https://pypi.python.org/pypi/battalion/

.. image:: https://pypip.in/wheel/battalion/badge.svg?style=flat
        :target: https://pypi.python.org/pypi/battalion/

.. image:: https://requires.io/github/rocktavious/battalion/requirements.png?branch=master
        :target: https://requires.io/github/rocktavious/battalion/requirements/?branch=master
        :alt: Requirements Status

Python framework for commandline applications

Quickstart
----------

Feeling impatient? I like your style.

.. code-block:: bash

    $ pip install battalion

In mycli.py script:

.. code-block:: python

    from battalion.api import *

    class DB(object):
        
        def __init__(self, state):
            self.msg = state.git_msg
    
        def myfunc(self):
            print self.msg
    
    @fixture
    def db(state):
        return DB(state)
    
    class mycli(CLI):    
        """
        Toplevel program - mycli
        """
        class State:
            version = '0.0.1'
            msg = ""
        
        def normal_function(self, db, data=None):  # NOTE: the "db" arg will be populated from the "db" fixture function
            """Takes in data and outputs new data"""
            if data is None:
                return db.myfunc()
            else:
                return data
        
        @command
        def greeting(cli, name="Hello"):
            """
            Prints "Hello {name}!"
            """
            print "Hello {0}!".format(name)

    class myhandler(Handler):
        """
        Organizational container of commands which can also add state variables
        """
        class State:
            version = '0.0.2'  # Handlers can have their own versioning
            cli = 'mycli'
            msg = "World"

        @command
        def validate(cli, data):
            return data
        
        @command
        def hello(cli, msg=None):
{'fraction_non_alphanumeric': 0.1300486360752802, 'fraction_numerical': 0.00296045675618524, 'mean_word_length': 1.8876678876678876, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 24, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5159656', 'n_tokens_mistral': 1485, 'n_tokens_neox': 1425, 'n_words': 302}