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