click-config icon indicating copy to clipboard operation
click-config copied to clipboard

notify function and conf defaults

Open AFriemann opened this issue 8 years ago • 3 comments

Hey there,

first of all thank you for this project. It comes down to a really nice solution overall. Unfortunately I have 2 minor issues with it.

The notify function

While I agree that debug logging would be nice here, simply printing to stdout is kind of annoying. I'd like to have control over my application output without resorting to monkey patching your project. Using python logging would solve this easily

import logging
notify = logging.getLogger(__package__).debug

Would be the easiest solution here.

Config defaults

It would be nice to be able to set defaults for the configuration directory. E.g. I like to configure my projects from ~/.config/${PACKAGE}/config.{ini,yaml,cfg}. Click comes with the get_app_dir() function which would make this really comfortable. My current workaround is to set the environment variable

if not os.environ.get('CONF'):
    os.environ.update(CONF=click.get_app_dir(__package__))

Your type specification for the conf option gets in the way here, as exists is set to True and thus the directory needs to be created for this to work. It might be a good idea to make this behaviour configurable as well.

AFriemann avatar May 31 '17 22:05 AFriemann

Hi, I haven't used or maintained this project in a while. You raise some valid points. Is this still relevant to you?

bergundy avatar Feb 17 '20 08:02 bergundy

Hey @bergundy,

Me neither actually. I'd leave it up to you. I usually just resort to a json/yaml parser and a dict.

Would definitely add a note that it's more or less unmaintained though, since it still shows up in searches :)

AFriemann avatar Feb 19 '20 07:02 AFriemann

Thanks for the suggestion,, will do.

bergundy avatar Mar 18 '20 18:03 bergundy