1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
### Copyright (C) 1996 Per Zacho
### This program is free software; you can redistribute it and/or modify
### it under the terms of the GNU General Public License as published by
### the Free Software Foundation; either version 2 of the License, or
### (at your option) any later version.
###
### This program is distributed in the hope that it will be useful,
### but WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
### GNU General Public License for more details.
###
### You should have received a copy of the GNU General Public License
### along with this program; if not, write to the Free Software
### Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
proc alias {} {
# User<->Bash interface / Command aliases
Desc "This configuration page will help you to setup command aliases."
ShortDesc "Command aliases"
### Command aliases ###
Header head1 -text "Command aliases"\
-background gray\
-help "Setup of command aliases."
Entry comAlias -text "Alias"\
-help "Specify an alias (nickname) for the command(s). No wildcards (*, ?) allowed, and"\
"the name of the alias may only be one word long."
Entry comCommand -text "Command(s)"\
-help "Specify command(s) to execute when alias is invoked. If you wish to use special"\
"characters--literals, dollarsign, etc, use backslash as prefix. If you wish to execute"\
"more than one command, use semicolon (\;) as delimiter."
ExtEntry aliasList -text ""\
-entries {comAlias comCommand}\
-help "Define shorthand for (long, cryptic) commands."\
-index comAlias\
-count 5
PageEnd {
set temp 1
forevery aliasList {
if {$comAlias == "" && $comCommand != ""} {
error "No alias specified for command in line $temp"
}
if {$comAlias != "" && $comCommand == ""} {
error "No command specified for alias in line $temp"
}
if {[llength $comAlias] > 1} {
error "Alias in line $temp is more than one word long"
}
}
}
Save {
forevery aliasList {
if {$comAlias != ""} {
print "alias [string trim $comAlias " "]='$comCommand'"
}
}
}
}
|