notmuch-addrlookup-c icon indicating copy to clipboard operation
notmuch-addrlookup-c copied to clipboard

Respect notmuch-config(1) FILES specs.

Open ferdinandyb opened this issue 3 years ago • 3 comments

WIP

Questions and comments:

  • I would make --config supersede any environment variables (the same as the notmuch command itself)
  • To actually conform to the specs, I'd need to check at each stage whether the file actually exists and go to the next one if it doesn't, otherwise we'll never get to $HOME/.notmuch-config. I did a quick search of how you do this in C, but as there are multiple ways and nothing really popped out as appropriate, what do you prefer for that? In the end I need a function that returns a true or false :)
  • I'd probably add a G_OPTION_ARG_NONE type --debug flag which prints which config file / database is actually used in the end, or maybe at that point maybe the "check file exists" func could print each file it tries, otherwise I think it might get confusing if things don't work as expected.

ferdinandyb avatar Sep 17 '22 22:09 ferdinandyb

Thanks for the followup! It is indeed just half-done. Could you also check my question about the config override and the debug flag?

ferdinandyb avatar Oct 13 '22 14:10 ferdinandyb

Thanks for the followup! It is indeed just half-done. Could you also check my question about the config override and the debug flag?

My two cents:

  • Yes, it makes sense that --config is more important and takes precedence.
  • I think we do not need a --debug option, you can use g_debug() and by default debug messages are not shown, and setting e.g. G_MESSAGES_DEBUG=all in the environment can then be used to have them shown. As a bonus, GLib will handle adding timestamps, process identifier, and a few other goodies.

aperezdc avatar Oct 13 '22 15:10 aperezdc

perfect, I'll likely take a week or two to follow up

ferdinandyb avatar Oct 13 '22 15:10 ferdinandyb