René Scharfe wrote: > PARSE_OPT_OPTARG overrides PARSE_OPT_LASTARG_DEFAULT, as Pierre noted in > commit 1cc6985c, which introduced the latter, so the two should not be > used together. Ok, thanks. This means I used it wrong when I switched over show-branch :-/ I'll have to send a follow-up patch for that. > PARSE_OPT_LASTARG_DEFAULT uses the default value if the option is the > last one on the command line and requires an explicit argument if it's > not the last, as you found out above. That's also what the code says > and its name implies; the comment in parse-options.h (by yours truly) > is probably misleading because it doesn't mention this condition. I was mislead. When I read it I thought I had to use the flag to say that the default value will be used in the case when no argument is given. I completely ignored the LASTARG part (I thought it was referencing the default arg). I think just adding what you said here to parse-options.h will help others to avoid this. > I don't remember any other program having options with such a > behaviour; I'm not sure how to stress that --merged needs to be the > last option, as implied by the help message. "git tag --contains" is the same. Figuring out a way to say that the syntax changes when it's the last option versus in the middle is not obvious to me either. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html