alias findalias {
; no such custom alias
if (!$isalias($1).fname) { echo -a Found no such alias $qt($1) $+ . }
; if the custom alias is in a "aliases file": return only the matching filename
else {
var %file = $isalias($1).fname, %nr = 1
while ($alias(%nr)) {
if (%file == $v1) {
echo -a Found alias $qt($1) in alias-file $qt(%file) $+ . As this is no remote, cannot find the exact line anyway.
return
}
inc %nr
}
; if the custom alias is in a "remote file": find the alias and its line number by filtering that remote file
var %w = @alias.filter
window -h %w
filter -gfwcn %file %w $+(/(alias|alias\s+-l)\s+,$1,\s+/i)
if ($line(%w,1)) {
var %line = $v1, %nr = $gettok(%line,1,32), %alias = $gettok(%line,$iif(($gettok(%line,3,32) == -l),2-4,2-3),32)
echo -a Found $qt(%alias) at line %nr of file $qt(%file)
}
else { echo -a Found alias $qt($1) in remote-file $qt(%file) $+ . Cannot find the exact line anyway. }
window -c %w
}
}