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

Re: [PATCH] Make '!' aliases more useful

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 3, 2007, 11:27 UTC
Message-ID
<Pine.LNX.4.64.0707031217480.4071@racer.site>
In-Reply-To
<81b0412b0707030007o328f0b35hfa758e1f3b2ef289@mail.gmail.com>
Hi,
On Tue, 3 Jul 2007, Alex Riesen wrote:
Show 21 quoted lines
> On 7/2/07, Theodore Tso <tytso@mit.edu> wrote:
> > On Mon, Jul 02, 2007 at 04:55:24PM +0100, Johannes Schindelin wrote:
> > > > But what if you don't want the argument passed at the end of the
> > > > alias, but somewhere else?  I suspect the better answer would be to
> > > > support $* and $1, $2, $3, et. al interpolation, no?  It was on my
> > > > list of things to do when I had a spare moment, but I never got around
> > > > to it.
> > >
> > > There is a point where you do not want to complicate git, but rather
> > write
> > > a script. This is such a point IMHO.
> > 
> > Such a point exists, I agree, but I would draw after $* and $1/$2/$3
> > interpolation.  There is a lot more value that gets added with
> > positional arguments support, and it makes git aliases more usable on
> > platforms such as Windows where scripting capability is much more
> > limited.
> 
> I don't think it is _possible_ to make it work on Windows properly: you have
> to quote the arguments with whitespaces as there is nothing like argv there
> (windows programs don't use command line, so it does not exist).

Since the "!" aliases use system() (i.e. no argv, but a plain string as parameter), my patch already does that. It quotes the arguments properly.

> As the quoting is implemented in the programs the rules are all different
> and mostly suboptimal.

You mean the programs that could be called via "!" aliases? Yes, that is right. And there is also the problem that you have to convert path names if you are working on Windows, because of this c:\&@!§$ braindamage.

However, in this case Junio's idea to use the shell to do the hard work is again an alternative:

	[alias]
		alex = !sh -c 'd:\program.exe $(cygpath -w "$1")'

FWIW I do not think that executing the shell from time to time is a big problem. It's only that I would like to get rid of the dependency on perl and bash for the plain Windows user, who will not dare to leave the gui into the command line jungle where there be bisons, yaccs and kills.

Ciao, Dscho

Previous: Alex Riesen
Message 11 of 11 in “Make '!' aliases more useful”
  1. Make '!' aliases more usefulJohannes Schindelin, Jul 1, 2007
  2. Theodore TsoJul 2, 2007
  3. Johannes SchindelinJul 2, 2007
  4. Theodore TsoJul 2, 2007
  5. Junio C HamanoJul 2, 2007
  6. Theodore TsoJul 3, 2007
  7. Johannes SchindelinJul 3, 2007
  8. Theodore TsoJul 3, 2007
  9. Johannes SixtJul 3, 2007
  10. Alex RiesenJul 3, 2007
  11. Johannes SchindelinJul 3, 2007

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.