garenchan / pycli Goto Github PK
View Code? Open in Web Editor NEWA Tiny Python CLI Library Based On argparse
A Tiny Python CLI Library Based On argparse
First, great tool! I was looking for something exactly like this for a long time and I was happy to find this.
I would like to know: would it be possible to have a different setup for list arguments? Right now, it requires calling the argument as many times as elements in the list (e.g. --my_list 1 --my_list 2 etc) which can be cumbersome for long list or long argument names. Another option would be to use the nargs option. I tested it and it works by modifying a few lines:
At
Line 96 in 20fd506
action = _parser.add_argument(name, action=action_name, nargs=nargs)
with nargs set to 1 by default, and to '+' if annotation is iterable, here:
Line 84 in 20fd506
Let me know if you consider implementing it, otherwise, I'll fork the repository, but I would prefer to stick to this repo if I can since it can be easily installed with pip.
From reading the code I think it's possible to use this with class methods, but I don't know how, can you give a sample?
I also need to have global options to pass an optional token (something like --token <string>
) to every command. Is there a way to specify this in one place and handle parsing centrally?
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.