gotz icon indicating copy to clipboard operation
gotz copied to clipboard

cli flag to pass custom config file path

Open danielwerg opened this issue 1 year ago • 5 comments

Relevant if #26 is accepted.

gotz # $XDG_CONFIG_HOME/gotz/config.json
gotz --config ~/.config/gotz/ecorp.json
gotz --config ~/.config/gotz/family_and_friends.json
gotz --config ~/my/custom/path/gotz_config.json

danielwerg avatar Feb 28 '25 02:02 danielwerg

Yeah, I think that would be useful to have.

A question: Do you think having multiple files is preferable, or having multiple profiles in one file? Or is both interesting? 🤔

I could imagine this for profiles:

gotz --profile ecorp
gotz -p ecorp # Possibly having a shortcut handle as well

Overriding the config location feels a bit like a job for an env var to me. So I could imagine it like this:

GOTZ_CONFIG=~/.config/gotz/ecorp.json gotz

Or exported for changing it for the ongoing terminal session:

export GOTZ_CONFIG=~/.config/gotz/ecorp.json
gotz 15
gotz --live

Let me know what you think. 😊

I will look at this while also looking at #25 & #26 (related as you pointed out already).

merschformann avatar Mar 02 '25 00:03 merschformann

What the difference between config and profile in your example?

I want to have two (potentially more) different configs/profiles for work and family, they would have different colors and timezones array, maybe some other values will differ too, like style.symbols, but I haven't played around with it enough to say.


Also +1 for shortcut handle

danielwerg avatar Mar 02 '25 20:03 danielwerg

The gotz config ... allows editing the config (or one profile - default or named), while gotz --profile <your-profile> uses one of your (potentially many) named profiles. This also means that the two can be used in combination, e.g., gotz config --profile profile1 --hours12 true would configure profile1 to use the 12-hour clock. I think this should support your use-case fine. It's just that it will all be in one config file. And we can still extend it to also support multiple configuration files on top of each of them allowing multiple profiles. 😊

merschformann avatar Mar 02 '25 21:03 merschformann

Oh, you want to change config structure to something like this:

{
  "config_version": "2.0",
  "profiles": [
    { "name": "default", ... },
    { "name": "work", ... }
  ]
}

danielwerg avatar Mar 02 '25 21:03 danielwerg

Yes, while keeping the profile / config at root level for backwards compatibility. It would be the default profile, if no explicit name is provided. Being able to swap the default could be a later extension.

merschformann avatar Mar 02 '25 22:03 merschformann