git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] parse-options: add PARSE_OPT_FAKELASTARG flag.

From
Pierre Habouzit <madcoder@debian.org>
Date
Jul 9, 2008, 07:47 UTC
Message-ID
<20080709074724.GB23482@artemis.madism.org>
In-Reply-To
<7vvdzfoo1s.fsf@gitster.siamese.dyndns.org>
On Wed, Jul 09, 2008 at 01:15:43AM +0000, Junio C Hamano wrote:
Show 25 quoted lines
> Pierre Habouzit <madcoder@debian.org> writes:
> 
> > If you set this for a given flag, and the flag appears without a value on
> > the command line, then the `defval' is used to fake a new argument.
> >
> > Note that this flag is meaningless in presence of OPTARG or NOARG flags.
> > (in the current implementation it will be ignored, but don't rely on it).
> >
> > Signed-off-by: Pierre Habouzit <madcoder@debian.org>
> > ---
> >
> >     >   (3) inspired from (1) and (2), have a flag for options that says
> >     >       "I do take an argument, but if I'm the last option on the
> >     >       command line, please fake this argument for me.
> >     >
> >     > I really like (3) more FWIW as it doesn't generate ambiguous
> >     > parsers like (2) would, and it's not horrible like (1). And cherry
> >     > on top it's pretty trivial to implement I think.
> 
> Yeah, I do not particularly want a major rewrite that only introduces
> possible ambiguity to the option parser (even though arguably it would add
> to the usability very much, just like we accept revs and paths when
> unambiguous), so I think this is a reasonable compromise.
> 
> It feels more like LASTARG_DEFAULT but that is bikeshedding ;-)
  I absolutely don't like this FAKELASTARG name, so really, use what you
like.
> But I see one thinko (fix below) and another issue I am not sure what the
> best fix would be.
  Like I said it was just a draft, I did not test the new feature, so
I'm not really surprised it's partly broken ;)
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org
Previous: Junio C Hamano
Message 9 of 9 in “What should "git branch --merged master" do?”
  1. Junio C HamanoJul 8, 2008
  2. Pierre HabouzitJul 8, 2008
  3. parse-options: add PARSE_OPT_FAKELASTARG flag.Pierre Habouzit, Jul 8, 2008
  4. Junio C HamanoJul 9, 2008
  5. 1/2 branch --contains: default to HEADJunio C Hamano, Jul 9, 2008
  6. 2/2 branch --merged/--not-merged: allow specifying arbitrary commitJunio C Hamano, Jul 9, 2008
  7. Pierre HabouzitJul 9, 2008
  8. Junio C HamanoJul 9, 2008
  9. Pierre HabouzitJul 9, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.