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

Re: git alias for options

From
Jeff King <peff@peff.net>
Date
Feb 18, 2017, 06:33 UTC
Message-ID
<20170218063345.3owwc2pwptdv2zu6@sigill.intra.peff.net>
In-Reply-To
<CAM_JFCzoouREM5-6aq9wb0ouT34GKCoJ_pcsww5TYKAdztR9sA@mail.gmail.com>
On Fri, Feb 17, 2017 at 02:34:15PM -0800, hIpPy wrote:
> I think the conversation has drifted away from what I am asking / hoping for.

Yeah, the usual answer to "can we have custom options" is "use a custom alias". But I agree they are not quite the same thing.

Show 8 quoted lines
> Say I want an alias for option --name-status as -s, so I can type:
> $ git log -s
> 
> But there is already a -s option and that wins so the built-in option
> alias wins.
> 
> However, I think I should be able alias it as --ns.
> $ git log --ns

To be honest, I am not that enthused about the idea, but I don't have an real objection beyond "meh, that looks like an unnecessary complication".

If anybody wants to pursue it, the simplest way would probably be to teach parse-options to take a callback for an unknown option, which could then do a config lookup to transmute the argument into another option-name.

Though many of the options (notably the revision-walker and diff ones) are not handled by parse-options. So that might present a challenge.

-Peff
Previous: hIpPy
Message 9 of 9 in “git alias for options”
  1. hIpPyFeb 17, 2017
  2. Michael J GruberFeb 17, 2017
  3. Ævar Arnfjörð BjarmasonFeb 17, 2017
  4. Jeff KingFeb 17, 2017
  5. Ævar Arnfjörð BjarmasonFeb 17, 2017
  6. Jeff KingFeb 17, 2017
  7. Junio C HamanoFeb 17, 2017
  8. hIpPyFeb 17, 2017
  9. Jeff KingFeb 18, 2017

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.