Re: FreeCOM feature review: ALIAS
[email protected] Mon, 11 Nov 2002 10:23:12 +0100 (CET)
| Newsgroups | gmane.os.freedos.devel |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 11 Nov 2002, Eric Auer wrote: > @echo off > echo Setting up ALIASes. Type ALIAS to view a list! > > rem alias go=locate %1 /d+ /g /n > > rem does not work, because alias does not process %1 and > rem locate must have filespec as FIRST argument > rem so I must keep using GO.EXE which only searches the current drive! Bad designed program ;-) Feature is already on to-do list. > But I wonder if it is possible to auto-load the aliases (not by simply > call fdalias.bat No. And is not planned. > in fdauto.bat / autoexec.bat but by something that even works for NEW > instances of FreeCOM, for example when I shell out from TED3 (tiny editor: The following features are on the to-do list: a) inheritance of Aliases and/or sharing of aliases among all FreeCOM instances; b) 4dos like 4START/4END scripts. > ALIAS just works like "whenever the command starts with FOO, and there > is an ALIAS FOO=BAR..., pretend that the line would have started with > BAR...". So you cannot play around with command line arguments or anything. I cannot follow / understand what's the point here. I've explicitly dropped aliases of the form: ALIAS LS /L=DIR ALIAS LS=DIR /W and I won't re-enable this for the simple reason that it caused quite mis-interpretation for most users (e.g. complaining that LS /F/L does not trigger the LS /L alias), secondly the processing in this way is by far more easier. On feature list is such behaviour: 1) ALIAS /B go=locate %%1 /d+ /g /n 2) ALIAS ls=dir/w Variant 1) will interprete "GO" like a batchfile, but with this single line as its contents; hence it breaks GO's command line into argument and creates a new argument context (ergo %1 == 1st argument a.s.o.). Variant 2) as now. 4DOS has a feature to auto-detect the variant 1) by checking the command line for argument auto-variables (namely, %1..%9 and associates). It's nifty, but may fail in certain circumstances. Also, because you have either-or, there is the need to substitute a number of arguments as once, e.g. here: ALIAS /B GO=locate %%1 /d+ %%2 /g /n %%3& So that: %1/%2 as usual and %3& is substituted by all arguments %3..%#. (%3& is 4dos like and is an extension of the bash's "%@" syntax). Bye, -- Steffen Kaiser The current maintainer of [email protected] http://freedos.sourceforge.net/freecom/FreeCOM.html