WARNING: A terrible sense of humor lies below
Introducing klarg v0.0.1. What is klarg? You might ask, and I might tell you that it is the result of bad decisions upon bad decisions. Or that it is a dead simple command line argument processing library. But that sounds like bragging.
Why should you use it? Well, if me making it is not enough, then just look this
# glorious_syntax.py
import klarg
klarg_is_cool = klarg.get_bool("klarg-cool")
if klarg_is_cool: # Not even considering another option
print("Klarg is cool")
When we do this ...
python glorious_syntax.py --klarg-cool
We get this
Klarg is cool
You can also configure klarg as easily as you can make a cake. (which by the way, is very easily). I mean, just look at this
import klarg
klarg.config["long_prefix"] = "+"
Just like that. We can call that taking advantage of python's awesomeness, just like that.
Also, there are no third party dependencies. wow, much rare
On a more serious note, check it out on github, it actually is a pretty cool project.
Klarg
A Kommand Line ARGument parsing library.
Klarg is a small and simple command line argument parsing library built with no 3rd party dependencies.
Why use klarg?
Simple syntax
It abstracts all the complexities away so that you can focus on developing the appication itself.
# example.py
import klarg
name = klarg.get_str("name")
print(f"Your name is: {name}")
# python example.py --name klarg
# Your name is: klarg
Easy configuring
It makes use of the powerful dictionary data type to make configuring klarg a breeze.
# example.py
import klarg
# Replace -- with +
CONFIG["long_prefix"] = "+"
name = klarg.get_str("name")
print(f"Your name is: {name}")
# python example.py +name klarg
# Your name is klarg
Simple data types
Klarg only returns basic data types such…
Top comments (2)
Library simplicity convinced me to give it a try. Good sense of humor just made it my new favorite parsing lib.
Thank you for sharing!
You`re welcome, Thanks for trying it out :)