Junio C Hamano <gitster@xxxxxxxxx> writes: > The 'g' and '/' commands take _mandatory_ arguments, but we do not > even mention it in the help text. But we need to say something for > this new thing, because it is _optional_ and if you do not give a > program, it does not ask. By the way, although I personally do not have much sympathy to those who set it, in the presence of interactive.singleKey configuration variable, a command that takes optional argument may turn out to be a mistake, as the user cannot give the argument even if they wanted to, when the configuration variable is set to true. To help them, we'd probably need something like the following to allow them to optionally set their own program, like the following: 1. read the command, notice that it begins with '|'. 2. if it has <program> after it, call it <program> and jump to 5. 3. if it does not have <program> after it, but if single key operation is in effect, give the user a chance to give <program> by prompting. Call the answer to the prompt <program>. If it is not an empty string, jump to 5. 4. at this point, we have <program> that is empty as given by the user. Replace the <program> with the value we remembered from step 6. during the last use of the '|' command. 5. if <program> is all whitespace, replace it with an empty string. 6. remember the value of <program> (so that you can reuse it next time the user says '|' and without <program>), and call the "set-custom-pager" thing with <program> (this design assumes that "set-custom-pager" thing uses the GIT_PAGER when fed an empty string). 7. spawn the program set by "set-custom-pager", and feed our output to it. So the end-user observable behaviour would become * There is the "default" program, initially their pager, but after they use the '|' command, we remember the last program they used during the session and reuse it when they tell us to do so. * For singlekey folks, typing '|' will give them a prompt. They can give an empty string and spawn the "default" thing. They can give " " plus <RET> to reset the "default" to GIT_PAGER and use it. Or they can give <program> plus <RET> to use it and update the "default". * For the rest of us, typing "|" plus <RET> will spawn the "default" thing. Typing "|<program>" plus <RET> will use the <program> and update the "default". Typing "| " plus <RET> will reset the "default" to GIT_PAGER and use it. which is quite straight-forward and consistent between the two camps.