Simple tool for creating commands & sub-commands
Project description
Simple tool for creating pluggable commands and sub-commands.
Usage example:
# 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:
# 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)
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
argsrun-0.0.2.tar.gz
(4.0 kB
view details)
Built Distribution
File details
Details for the file argsrun-0.0.2.tar.gz
.
File metadata
- Download URL: argsrun-0.0.2.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d29a762860d4d3b73e6fe01f65a8f776f7fd00f5ec25374401b2cab584146d9 |
|
MD5 | a7cd471188c13e1a60e8f05bc001aca8 |
|
BLAKE2b-256 | a9a1e9d318c2ae024f76712b73498937df0efe9a91536a1e87d2f56439ce4d1f |
File details
Details for the file argsrun-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: argsrun-0.0.2-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 844fbc8e5ccdeea0fc59e30beb8e22d2900d930315cb16b1a25de967c2fb3999 |
|
MD5 | fe6102042f69f41e5e8d71dff612d39b |
|
BLAKE2b-256 | 96a9c3351069e25c8e0fc98dd0d94b872b76872c356fe3658d33a21e685d7954 |