Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Get-Alias

Aug
1,929
71
Hi,
While TCC has the ALIAS command to list all currently defined aliases, I find it a bit difficult to read. I have written a simple batch file that lists all currently defined aliases in two columns.

Code:
@setlocal
@if %_echo eq 1 @echo off
if %@len[%@alias[%1]] eq 0 goto showall
if %@len[%@alias[%1]] gt 0 goto showit
goto eoj

:showit
gosub headers
screen %_row  0 %1
screen %_row 16 %@alias[%1]
goto eoj

:showall
gosub headers
alias > clip:
setdos /X-45678
do theline in @clip:
  screen %_row  0 %@word["=",0,%theline]
  screen %_row 16 %@alias[%@word["=",0,%theline]]
  ::
  :: If your aliases are too long, you could un-comment the following line;
  ::
  ::screen %_row 16 %@left[60,%@word["=",1,%theline]]
  ::
  echo.
enddo
setdos /X0
goto eoj

:headers
screen %_row  0 Name
screen %_row 16 Definition
echo.
screen %_row  0 ----
screen %_row 16 ----------
echo.
return

:eoj
endlocal
 
alias | list /sn
not as easy to read but you get use to it

----- Original Message -----
From: "Joe Caverly" <>
To: <[email protected]>
Sent: Friday, October 30, 2009 2:45 PM
Subject: [T&T - Scripting-t-1523] Get-Alias



> Hi,
> While TCC has the ALIAS command to list all currently defined aliases, I
> find it a bit difficult to read. I have written a simple batch file that
> lists all currently defined aliases in two columns.
>
>
> Code:
> ---------
> @setlocal
> @if %_echo eq 1 @echo off
> if %@len[%@alias[%1]] eq 0 goto showall
> if %@len[%@alias[%1]] gt 0 goto showit
> goto eoj
>
> :showit
> gosub headers
> screen %_row 0 %1
> screen %_row 16 %@alias[%1]
> goto eoj
>
> :showall
> gosub headers
> alias > clip:
> setdos /X-45678
> do theline in @clip:
> screen %_row 0 %@word["=",0,%theline]
> screen %_row 16 %@alias[%@word["=",0,%theline]]
> ::
> :: If your aliases are too long, you could un-comment the following line;
> ::
> ::screen %_row 16 %@left[60,%@word["=",1,%theline]]
> ::
> echo.
> enddo
> setdos /X0
> goto eoj
>
> :headers
> screen %_row 0 Name
> screen %_row 16 Definition
> echo.
> screen %_row 0 ----
> screen %_row 16 ----------
> echo.
> return
>
> :eoj
> endlocal
> ---------
>
>
>
 
I would provide choice to list subsets:
Alias ShowAlias=`*ALIAS %$ | SORT | LIST /s `
(cmd style)
Alias ShowAlias=`*ALIAS %$& | SORT | LIST /s `
(4DOS style)
Notice the * in front of ALIAS so it could work on anyone's system, even if they already have a different definition of ALIAS...
 
Back
Top