when you use /alias command, if the alias with name given exists, it automaticaly gets replaced. when you use this code, the script checks is there an alias with given name, and if there is, you get asked do you want to replace an old alias with new one.
Just to be sure... :]
alias alias {
; first we check is there an alias with same name
if ($isalias($1)) {
; if htere is an alias with same name, script asks you do yo want to replace it with new one
if ($input(There is already an alias called $1 in $nopath($isalias($1).fname) with function : $crlf $&
$crlf $isalias($1).alias $crlf $crlf Do you want to override it and set it to : $crlf $crlf $2- $&
$crlf $crlf ?,yw,Alias $1 already exists!) == $true) {
; then we add the new alias
alias $1-
echo -a [Alias] Alias " $+ $color(info) $+ $1 $+ " reasigned to new function " $+ $color(info) $+ $2- $+ "
}
}
else {
; If there is no alias with such name, then it's simply added.
alias $1-
echo -a [Alias] New alias " $+ $color(info) $+ $1 $+ " added with function " $+ $color(info) $+ $2- $+ "
haltdef
}
}
well, it prevents accidental replacing of aliases.
also, if alias is somewhere in rfiles, and it has structure eg:
alias somealias {
.blah line 1
blah line 2
}
the function will be returned like :
\" alias somealias { \"
it displays aliases nice only if they\'re singleline.
will look into that. besides the output possible problem, the snippet works like a charm :)