Package: zensols.actioncli
Action and Mnemonic command line libraryThis library intends to make command line execution and configuration easy.
The library supports (among other features) an mnemonic centric way to
tie a command line anactionto a Python 3 handler code segment.
Features include:Better command line parsing thanoptparse.  This a binding to from a
command line option using an action mnemonic to invocation of a handler.Better application level support for configuration thanconfigparser.
Specifically, optional configuration and configuration groups.ObtainingThe easiest way to obtain this package is viapip:pipinstallzensols.actioncliBinaries are also available onpypi.UsageTwo ways to use this project follow.  The easiest way is to use the template
method.  Either way, first install the library viapiporeasyinstall.TemplateThe best way to get started is to template out this project with the following
commands:# clone the boilerplate repogitclonehttps://github.com/plandes/template# download the boilerplate toolwgethttps://github.com/plandes/clj-mkproj/releases/download/v0.0.7/mkproj.jar# create a python template and build it outjava-jarmkproj.jarconfig-stemplate/python
java-jarmkproj.jarStraight PythonIf you want to skip templating it out (i.e. don't like Java), create a command
line module:fromzensols.actioncliimportOneConfPerActionOptionsClifromzensols.actioncliimportSimpleActionClifromzensols.toolsimportHelloWorldVERSION='0.1'classConfAppCommandLine(OneConfPerActionOptionsCli):def__init__(self):cnf={'executors':[{'name':'hello','executor':lambdaparams:HelloWorld(**params),'actions':[{'name':'doit','meth':'print_message','opts':[['-m','--message',True,# require argument{'dest':'message','metavar':'STRING','help':'a message to print'}]]}]}],# uncomment to add a configparse (ini format) configuration file# 'config_option': {'name': 'config',#                   'opt': ['-c', '--config', False,#                           {'dest': 'config', 'metavar': 'FILE',#                            'help': 'configuration file'}]},'whine':1}super(ConfAppCommandLine,self).__init__(cnf,version=VERSION)defmain():cl=ConfAppCommandLine()cl.invoke()This uses theOneConfPerActionOptionsCliEnvclass, which provides a data
driven way of configuring the action based command line.  An extention of this
class is theOneConfPerActionOptionsCliEnvclass, which imports environment
variables and allows adding to the configuration via adding a resource like
file (i.e.~/.<program name>rc) type file.  See theSee thecommand line test casesfor more
examples.ChangelogAn extensive changelog is availablehere.LicenseCopyright (c) 2018 Paul LandesPermission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.