Repository navigation
Replies: 5 comments
|
In general, I am open to new community sourced ideas, and I appreciate the effort you put into this. However, Click is so widely used, that I would like to have more comprehensive docs and better test coverage before anything major is added, unless there is very clear community support. I will continue to keep an eye on this to see if it gathers community support. |
|
Ahah thanks @Rowlando13 for invoking me! 😁 @madduck I stumbled upon the very same limitations of Click Extra implements a ready-to-use Bonus features:
And lots of other stuff. So go try Click Extra and send me feedback there! 🤗 |
|
@kdeldycke oh this is fantastic, I've migrated my project to your work. I wish I had found it earlier! Thank you! |
|
Since that discussion, @madduck switch to my own Click Extra's As for the suggested new
So I guess this thread can be closed. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hello,
I recently wrote a CLI and used click, and I am loving it. I also wanted to provide the means for users to be able to create a configuration file in a default configuration, and even to provide a CLI option to override this default location. When data are read from the configuration file, they should actually override defaults, but not explicitly specified CLI options. I think this is what you'd normally expect, i.e. in the context of:
mycmd sub --foo, thenfooshould be true;mycmd sub, but a configuration file~/.config/mycmd/config.tomlexists with:fooshould be truefooshould default to false.Initially, I found click-configfile and was really excited, but three things kept me from falling in love:
@click.optionfor the config file parsing to work;configfile, i.e. "INI files", which are dreadful;So I set out to do it differently, with decorators. Let the code speak:
This would yield:
and you could create a file
~/.config/mycmd/config.tomlwith the following content:and that would be considered before CLI defaults are.
How do you like it?
You can see the implementation at https://github.com/madduck/pngx/blob/main/pngx/config.py
Is this something worth that might make it into click mainline?
There are a few things that would need to be done on integration:
ParameterSourceneeds a new member, e.g.CONFIGFILE(see here);BadConfigwould be better than just aClickException(see here).Where to take things from here?
All reactions