Get-Alias

#1
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
 
Aug 9, 2009
133
0
#2
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
> ---------
>
>
>
 
#4
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...