contains-io / rcli Goto Github PK
View Code? Open in Web Editor NEWRapidly create full-featured command line interfaces with help, subcommand dispatch, and validation.
License: MIT License
Rapidly create full-featured command line interfaces with help, subcommand dispatch, and validation.
License: MIT License
Much of the initial code is missing docstrings. These should be fully completed before release.
It should be possible for users to specify custom messages for the primary command.
This could be implemented as a setup
keyword mapping commands to messages.
Rapcom needs tests to cover all expected functionality. This is not intended to be exhaustive, but should at least handle the happy paths.
Users should be able to add functionality to the primary command when no subcommand is specified. e.g.
def hello():
"""usage: hello"""
print('Hello!')
If no subcommands are detected, the help message should not mention anything about subcommands, or allow the usage of subcommands; otherwise, subcommands should work as expected.
Usage strings should support internationalization and localization support.
These can be keyed on the full name of the object to which the docstring is attached and parsed using the docopt language.
Remove checks for .validate()
and .schema.validate()
because these will be entirely replaced by type hinting in 0.2.0+.
In dispatcher.py
, main()
uses a broad except to handle unexpected error logging. This should instead be a sys.excepthook.
On OSX with python 2.7, rcli throws an exception trying to encode unicode as ascii while writing the log file.
It should be possible to create a primary command without recreating all of the help logic or reproducing the entirely of the original help message.
Ideally, a single line usage string would be appended to the existing default help string.
If a subcommand is unknown, the primary command function should be called with the value of the subcommand.
It should be possible to configure options for rcli in setup.cfg.
This may involve writing egg info during installation.
Add a setup
keyword that will scan all python packages for modules, classes, and functions that have docopt
compatible docstrings and create entry points from those docstrings.
If an option is described as (--option <opt> | <opt>)
the value that is None
can overwrite the value passed in by the user.
This should be check the values. If one is None, and the other is not, then use the one that is not. If neither is none, normalize to a list of values.
fabric
raises SystemExit
which inherits from BaseException
rather than Exception
. rcli
should capture this and print the log.
It should be easy for clients using this project to access the log data. This can be handled by adding a wrapper function in log.py
that will return _LOGFILE_STREAM.getvalue()
Add a --log-level
attribute to the global command (that can exist anywhere in the command line arguments) that will set logging.
Normalization is very primitive. It should be changed to remove all invalid python characters, left strip all hyphens, and handle other conversion use cases.
When an error occurs, instead of just returning the exception, return the exception message plus a message telling the user to look at a log file.
The log file must be generated at the time the exception is caught.
After an exception has occurred, it's possible for appending the "Please see the log" message to cause a decode error if the string has an unexpected encoding.
In some cases, the TQDM progress bar is not being completely overwritten before the cursor is moved to another line. Left justifying the status description messages will force the line to be cleared.
The first line of a usage docstring should be parsed as the short description to be shown on the subcommand help list.
It should be possible to disable keyword normalization for commands with a setup
keyword in setup.py
.
If a consumer writes a function such as:
def hello(uppercase):
"""Usage: say hello --uppercase
Options:
--uppercase Shout it!
"""
the dedenting will fail because the first line doesn't match the indentation level of the rest of the usage string.
Output in the display is mangled when the display is not a TTY. The column detection already looks for this, but the widgets should as well.
When a client application has an error while importing the module, no error is raised, and rcli creates a "default" application instead of failing.
Google Fire allows command line interfaces to be created by passing a class to a Fire object and calling it. rcli
should allow the same functionality but with rcli
style documentation and typing.
rcli
was originally designed and written with Python 2 as a primary consumer. Python 2 has been deprecated since this year.
Consider upgrading to Python 3.5 or Python 3.6 as minimum versions of Python.
It should be possible to have subcommands that have subcommands and so on.
Invalid log levels should be handled without causing a visible exception while debugging.
Generated commands should also automatically generate bash and zsh autocompletion scripts to be installed alongside the commands.
Add tests for all known use cases.
This should also add coveralls support and configure .travis.yml
to run the tests as well as linting.
Simple validation should be provided when the function includes type hints.
Currently, normalization checks to verify that a normalized value is not a keyword, but it should also check to see if it is in the built-ins to keep from shadowing those values.
if keyword.iskeyword(nk):
should become if keyword.iskeyword(nk) or nk in six.moves.builtins:
This should be assumed with issue #59 .
When given a docstring such as usage: say say
and running the command say say
, the usage message is displayed instead of executing the entry point.
The help subcommand for primary commands prints the default docstring instead of trying to print the custom usage string.
Usage strings should wrap automatically to the size of the terminal being used. Currently, this is limited by the output of docopt
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.