Thread (19 messages) flat view 19 messages, 6 authors, 2016-06-15

Re: [PATCH] Add an optional <mode> argument to commit/status -u|--untracked-files option

From: Jeff King <hidden>
Date: 2016-06-15 22:44:41

On Tue, Jun 03, 2008 at 11:17:28PM +0200, Marius Storm-Olsen wrote:
You are right. This is the joy of the parse-options() handling of  
short-options with optional arguments.

-us before meant:
    1) commit
    2) show all untracked files
    3) sign-of the commit

I guess it would be possible to reparse the options without the -u, if  
the argument is not one of the three (none,normal,all), but I'm not sure 
it's _that_ critical. Opinions?
I think it would be reasonable to make "-u" mean the same as always, and
for "--untracked-files" to have an optional argument. There isn't direct
support for that construct in parse_options, but you could just make it
two separate options that happen to tweak the same value (though I guess
they would be displayed separately in the auto-generated usage).

Some GNU utils use this strategy to extend existing options. E.g., "ls
-p" comes from XSI and takes no argument, but the long-option form of
--indicator-style=<none|slash|file-type|classify> gives more options.

That makes it a little less pleasant to type the extended version, but
compatibility is maintained.  Though I tend to wonder about this option
in particular...isn't this generally a user preference? Should it
perhaps be found in the config file instead?

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help