An implementation of the interface provided by the cmdln module but
using argparse to provide the option/arg heavy parsing.
Credit for this code goes foremost to Shakeeb Alireza, code was
initially found: [argdeclare: declarative interface to argparse](http://code.activestate.com/recipes/576935-argdeclare-declarative-interface-to-argparse/)
# Usage
from argdeclare import Commander, option_group, option, arg
def test():
# only for options which are repeated across different funcs
common_options = option_group(
option('-t', '--type', action='store', help='specify type of package'),
arg('package', help='package to be (un)installed'),
option('--log', '-l', action='store_true', help='log is on')
)
class Application(Commander):
'a description of the test app'
name = 'app1'
version = '0.1'
default_args = ['install', '--help']
@option('--log', '-l', action='store_true', help='log is on')
@arg('pattern', help="pattern to delete")
def do_delete(self, options):
"help text for delete subcmd"
print(options)
@option('-f', '--force', action='store_true',
help='force through installation')
@common_options
def do_install(self, options):
"help text for install subcmd"
print(options)
@common_options
def do_uninstall(self, options):
"help text for uninstall subcmd"
print(options)
app = Application()
app.cmdline()
if __name__ == '__main__':
test()
Metadata
Release files for argdeclare 0.5.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| argdeclare-0.5.6.tar.gz | 3.4 kB | Without provenance | Details for argdeclare-0.5.6.tar.gz |
Release files / argdeclare-0.5.6.tar.gz
| Download URL | argdeclare-0.5.6.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63fe30070f4aedff832801c42f9e00ea199df3509309a0ac79aa731df73a7ea2
|
|
BLAKE2b-256 checksum How to use checksums |
495e0cb3c7b9da9824999c8042506d28ca4027f268806e9f983fd225b62a8faf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for argdeclare 0.5.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.