The small framework for sub commands.
Project description
jumon is a small framework for sub commands.
The jumon is a small framework for sub commands, It can define sub commands as modules hierarchical structure.
Installing
Use setup.py in the source code root directory:
$ python setup.py install
by pip (from PyPI)
$ pip install jumon
How to use
This is a description of how to use the jumon.
Create the top command
testcmd/command/__init__.py:
import jumon def main(): jumon.entry(__name__)
setup.py:
#-*- coding: utf-8 -*- from setuptools import setup, find_packages setup( name='testcmd', version='1', license='BSD', author='TakesxiSximada', author_email='takesxi.sximada@gmail.com', packages=find_packages(), entry_points = """\ [console_scripts] testcmd = testcmd.command:main """ )
This is important:
entry_points = """\ [console_scripts] testcmd = testcmd.command:main """
Create sub commands
testcmd/command/aaa.py:
def main(argv): print 'OK'
testcmd/command/bbb/__init__.py:
def main(argv): print 'bbb'
testcmd/command/bbb/ccc.py:
def main(argv): print 'ccc'
example:
$ pip install ./examples Unpacking ./examples Running setup.py egg_info for package from Cleaning up... $ testcmd aaa OK $ testcmd bbb bbb $ testcmd bbb ccc ccc $ testcmd bbb ddd a a_func [] $ testcmd bbb ddd b b_func [] $ testcmd bbb ddd c c_func []
Do you want to transparenting the undefined options?
You can use jumon.TransparentOptionParser() class.
>>> import jumon >>> parser = jumon.TransparentOptionParser() >>> opts, args = parser.parse_args(['-f', '-n', '1']) >>> args ['-f', '-n', '1']
Requirements
Python 2.6 or laterr (not supprt 3.x)
License
Apache License 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jumon-1.0.0.tar.gz
(4.8 kB
view hashes)