Metadata-Version: 2.0
Name: xacto
Version: 0.8.7
Summary: Generate command-line interfaces (CLI) by introspecting callables
Home-page: http://github.com/xtfxme/xacto
Author: C Anthony Risinger
Author-email: c@anthonyrisinger.com
License: BSD
Download-URL: https://github.com/xtfxme/xacto/archive/0.8.7.zip
Keywords: cli commandline command introspection generate
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Operating System :: POSIX
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4

Xacto
~~~~~

**CLI Analyzer/Generator**

Introspect, compose, marshal and export arbitrary callables into a unified,
hierarchical, command-line interface (CLI)

Features
~~~~~~~~

auto-find tools
scan signatures and export as CLI node

Why
---

FAST! EASY! natural import usage! ``--help`` is decent!

Quickstart
----------

#. Install::

    # pip install xacto

#. Prepare::

    # ln -s $(which xacto) do

#. Create python file at ``tools/work.py``:

.. code-block:: python

    from pprint import pprint


    __all__ = ["easy", "hard", "manual"]


    def easy(method, speed=16, *tasks):
        """The simple version"""
        pprint(locals())


    def hard(method, speed=32, *tasks, **params):
        """The difficult version"""
        pprint(locals())


    class manual(object):
        """The laborious version"""

        def __call__(self, method, speed, *tasks):
            pprint(locals())

        def method(self, process):
            """Howto perform operation"""

        def speed(self, ops=64):
            """Operations per second"""

        def tasks(self, pri, sec, ter):
            """Various tasks"""

#. View ``--help``::

    # ./do work --help
    usage: do work OBJECT ...

    additional modules:
      OBJECT  := { .do.work }
        easy  The simple version
        hard  The difficult version
        manual
              The laborious version

#. View object-level ``--help``::

    # ./do work manual --help
    usage: do work manual --method PROCESS --speed [OPS] [tasks [tasks ...]]

    The laborious version

    positional arguments:
      tasks             Various tasks

    optional arguments:
      --method PROCESS  Howto perform operation
      --speed [OPS]     Operations per second

    The laborious version

#. Run tool (function)::

    # ./do work hard --method=cheat --code=iddqd taskN
    {'method': 'cheat',
     'params': {'code': 'iddqd'},
     'speed': 32,
     'tasks': ('taskN',)}

#. Run tool (class)::

    # ./do work manual --method=cheap --speed=256 taskN
    {'method': 'cheap',
     'self': <do.work.manual object at ...>,
     'speed': '256',
     'tasks': ('taskN',)}

Limitations
-----------

- true/false quirkyness (default=True means --default flips to False)

TODO
----

- RELEASE!
- testing: set-like functions, import semantics.. everything
- handle bools better
- detect output
- standard output structure
- prettify to tty
- lazy load tools
- lazy import globals (cpython)
- bytecode cache
- argument forwarding/chaining
- integrate with zippy.shell
- tab-completion
- auto-reduce common components for aliases
- make xacto object accessible to tools


