Skip to main content

Generate command-line interfaces (CLI) by introspecting callables

Project description

Xacto

a typelib and 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 if default is callable, call it to setup arg

Why

FAST! EASY! natural import usage! –help is decent-ish with types/etc! AH!

Quickstart

  1. Install:

    # pip install xacto
  2. Run:

    # ln -s /path/to/bin/xacto do
  3. Create python file at tools/work.py:

    __all__ = ["easy", "hard"]
    #__xacto__ = {...}
    
    def easy(method, speed=16, *tasks):
        print(locals())
    #easy.__xacto__ = {...}
    
    def hard(method, speed=32, *tasks, **params):
        print(locals())
    #hard.__xacto__ = {...}
  4. Run:

    # ./do work easy --method=never task1 task2
  5. Run:

    # ./do work hard --speed=64 --method=cheat --code=iddqd taskN

Limitations

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

  • can’t handle lists (–arg a b c –other …)

TODO

  • RELEASE!

  • setuptools

  • symlink to binary to create new

  • testing: set-like functions, import semantics.. everything

  • handle bools better

  • handle lists (–arg a b c –other …)

  • 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

  • bind tools to xacto object (eg. celery/waf)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xacto-0.6.2.tar.gz (10.1 kB view hashes)

Uploaded Source

Built Distribution

xacto-0.6.2-py2.7.egg (9.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page