GitXplorerGitXplorer
p

argsrun

public
2 stars
0 forks
3 issues

Commits

List of commits on branch master.
Unverified
b4a6363418430cb234d172e45f60fb1b9c64556b

small fix

ppopravich committed 9 years ago
Unverified
0f13a3b774b2783ec5a1be78c09773f266952ae6

install_requires updated

ppopravich committed 9 years ago
Unverified
ec4fac47a6260d0abde28e2e7129b62e203ba821

.travis.yml updated -- 'cache: pip' added

ppopravich committed 9 years ago
Unverified
1bd667fe2c7106a858d225fa215b24bc387259dc

.travis.yml and python 3.5 fixes

ppopravich committed 9 years ago
Unverified
abc05e0f6c061ae539cd50c5749b54fab821af89

.travis.yml: coverage disabled for now

ppopravich committed 9 years ago
Unverified
88e458773776239d346d3ee22292631c8e640815

travis-ci config added

ppopravich committed 9 years ago

README

The README file for this repository.

Argsrun

Simple tool for creating pluggable commands and sub-commands.

Usage example:

.. code:: python

# in setup.py of your project specify argsrun entry point in console scripts
# and provided commands as follows:

setup(name="MyProj",
      # ...
      entry_points={
        'console_scripts': [
            'myproj = argsrun:main',  # argsrun will handle main command
        ],
        'myproj': [                   # ...and lookup for this subcommands
            'main = myproj:main',
            'run = myproj.module:run',
        ],
      })

In case you have several packages/projects and you want them to share same entry point, you can easily do it like follows:

.. code:: python

# my-frontend-app/setup.py

setup(name="MySite Frontend",
      entry_points={
        'console_scripts': [
            'mysite = argsrun:main',
        ],
        'mysite': [
            'serve-frontend = frontend:serve',
        ]
      })

# my-backend-app/setup.py

setup(name="MySite Admin backend",
      entry_points={
        'console_scripts': [
            'mysite = argsrun:main',
        ],
        'mysite': [
            'serve-admin = backend:serve',
        ]
      })

 # In my-frontend-app/frontend/__init__.py

 import argsrun

 def handler(options):
     # Run frontend app
     pass

 def parser_setup(ap):
     ap.add_argument('--port', help="Port to bind to")

 main = argsrun.Entry(handler, parser_setup)