Re: [PATCH] mergetool: new config guiDefault supports auto-toggling gui by DISPLAY
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 14, 2022, 09:10 UTC
- Message-ID
- <xmqqsfjqbwil.fsf@gitster.g>
- In-Reply-To
- <CAPMMpoigKVzhXu1WqSrx13MP1jR0J+ajkwRVVtY_LwHYAoWeTg@mail.gmail.com>
Tao Klerks <tao@klerks.biz> writes:
Show 5 quoted lines
> 1. Why add an OPT_CALLBACK_F arg handler, rather than keeping a simple > OPT_BOOL arg type? > Because OPT_BOOL always overwrites with either true or false, so in > order to have use_gui_tool retain its "_BY_CONFIG" value in the > absence of an arg, the explicit arg handler function is required.
That is exactly why you want to initialize the variable to something other than 0 or 1 (say "-1") and use that as "not explicitly specified from the command line" aka _BY_CONFIG value, isn't it?
And once you do so, you do not need callback and you do not need enum. The original "int" can take tri-state, (unspecified = -1, false = 0, true = 1).
Am I missing something?