On Fri, Jun 28, 2013 at 12:31:53PM -0400, Jeff King wrote: > It's possible to have an "optional" argument by using the > PARSE_OPT_OPTARG flag. However, it is not backwards compatible from the > user's perspective, as they must use the "sticked" form: > > git format-patch -ooutdir ... > > to specify the argument. Otherwise, it is not clear in: > > git format-patch -o outdir HEAD~ > > whether "outdir" is the argument to "-o", or if it is simply the next > argument. That would be a possibility but I don't like breaking backwards compability. > I'm not clear how that interacts with your example, though. Your example > tries to use "-o" to set output_directory to NULL. But it is already > NULL if you do not specify any "-o" at all. my goal is to make: git format-patch [-k] [(-o|--output-directory) <dir> | --stdout] [ <since> | <revision range> ] to be: git format-patch [-k] [(-o|--output-directory) [dir] | --stdout] [ <since> | <revision range> ] that would do: git format patch -> current dir git format patch -o -> default dir (for example GIT_DIR/.outgoing/) git format patch -o <dir> -> user defined <dir> But I guess I would need a new option instead. Something like --default-output-dir. -- Med vänliga hälsningar Fredrik Gustafsson tel: 0733-608274 e-post: iveqy@xxxxxxxxx -- 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