File: commLine.template

package info (click to toggle)
dotfile 1%3A2.4-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,472 kB
  • ctags: 523
  • sloc: tcl: 14,072; sh: 918; makefile: 177; lisp: 18; ansic: 7
file content (220 lines) | stat: -rw-r--r-- 7,077 bytes parent folder | download | duplicates (3)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
### 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 commLine {} {
    # User<->Bash interface / Commandline

    Desc "This configuration page will help you setup options"\
	"concerning the commandline. In particular which editing"\
	"mode is prefered, how to respond to scripts, etc."

    ShortDesc "Commandline"

    ### Shell behavoir ###

    Header head1 -text "Shell behavoir"\
	-background gray\
	-help "What keybindings do you want to use for your shell."

    Radio editmode -text "Select which editor keybindings Bash is to use"\
	-entryhelp {"emacs" "Use emacs keybindings."\
			"vi" "Use vi keybindings."}\
	-help "Choose how Bash is \"look and feel\". These two options"\
	"relate mainly to how the command line editor is to behave."\
	-packFrame:fill x

    Menu keymap -text "Keymap for commandline editor    "\
	-entries {"emacs" "emacs-standard" "emacs-meta" "emacs-ctlx" "vi" "vi-move"\
		      "vi-command" "vi-insert"}\
	-help "Here you can specify how the command line editor will bind keys. The above"\
	"does have influence on this setting. Usually setting the above will do."\
	-width 18\
	-packFrame:fill x

    CheckBox posix -text "Use IEEE 1003.2 Posix shell standard"\
	-default 0\
	-help "Shall Bash emulate the posix shell almost 100%. This mode differs"\
	"mainly in the way command lookup and function handling is done."\
	"It is only in very rare circumstances you would ever have to"\
	"use the posix mode."

    CheckBox interactcom -text "Allow interactive comments"\
	-default 1\
	-help "Is comments allowed in an interactive"\
	"shell. Comments are words beginning with \#, and will cause"\
	"the interpreter to ignore all remaining words on the"\
	"line. (This option is available in Bash version 2.0 only)"

    ### Command/script handling ###

    Header head2 -text "Command/script handling"\
	-background gray\
	-help "Do you want Bash to repeat your commands--useful for debugging scripts."

    CheckBox verb -text "Display shell commands before running them"\
	-default 0\
	-help "Display the shell commands, as they are read."

    CheckBox xtrac -text "Display shell commands after commandline processing"\
	-default 0\
	-help "Display shell command after it has been processed."\
	"In contrast to previous, commands are written as shell"\
	"will execute them (i.e. aliases, variables, etc. are expanded"\
	"to commands, paths, etc). For each level of expansion, Bash"\
	"will print (at default) \"+\", which is Prompt 4."

    CheckBox chkhash -text "Check command hash table, before searching path"\
	-default 0\
	-help "If set, Bash checks that a command found in the hash table exists"\
	"before trying to execute it. If a hashed command no longer exists, a normal"\
	"(and time consuming) path search is performed. (This option is	available"\
	"in Bash version 2.0 only)"


    ### Shell termination ###

    Header head3 -text "Shell termination"\
	-background gray\
	-help "How to terminate your Bash shell when finished."

    Int igneof -text "How many \"CTRL-d\" equals a \"logout\" or \"exit\" command"\
	-default 10\
	-help "You can specify how many consecutive \"CTRL-d\" key sequences equals"\
	"a \"logout\" or \"exit\" command."

    Line line1

    Label label1 -textafter "Bash is able to auto-logout\nif the shell is idle for"\
	"certain number of seconds."\
	-text "    "\
	-help "This option is intended for use with dial-up terminals, but can"\
	"also be used for other purposes (e.g. if you forget to"\
	"logout). If you leave the field blank, or type zero (0),"\
	"the auto-logout feature is disabled."
    
    Int timeout -text "Idle for"\
	-textafter "seconds before auto-logout (0 = disabled)"\
	-default 0\
	-help "This option is intended for use with dial-up terminals, but can"\
	"also be used for other purposes (e.g. if you forget to"\
	"logout). If you leave the field blank, or type zero (0),"\
	"the auto-logout feature is disabled."

    ### Miscellaneous variables ###

    Header head4 -text "Miscellaneous variables"\
	-background gray\
	-help "Location of Bash and your favourite editor."

    File-Dir-Browser editor -text "Location of favourite (default) editor"\
	-exist 1

    foreach elm {frame_editor editor com_editor} {
	Help $elm "Location of your favourite editor. Please remember to write the complete path"\
	    and name of editor. If in doubt, try \"whereis\" command with name of editor."\
	    "Then cut'n'paste information after the colon (:)"
}

    ShowPage {
        if {[set version@bash(index)]} {
	    Enable interactcom
	    Enable chkhash
        } {
	    Disable interactcom
	    Disable chkhash
        }
    }

    Init {
	### Read default values from shell ###
	if {[info exists env(EDITOR)]} {
	    set com_editor $env(EDITOR)
	} {
	    set com_editor "emacs"
	}
    }

    Change {
	if {$editmode(index)} {
	    if {$keymap(index) < 4} {set keymap(index) 4}
	} {
	    if {$keymap(index) > 3} {set keymap(index) 0}
	}
    }

    PageEnd {
	if {$igneof < 0} {error "You have to specify a positive (or zero) number of key sequences to equal \"logout\" or \"exit\""}
    }

    Save {
	### Shell behavoir ###
	if {$editmode(index) || $generateDefault} {
	    print "set -o [pick $editmode(index) vi emacs]"
	    print -file inputrc "set editing-mode [pick $editmode(index) vi emacs]"
	}

	if {$keymap(index) || $generateDefault} {
	    print -file inputrc "set keymap $keymap(name)"
	}
	    
	if {$posix || $generateDefault} {
	    print "set [pick $posix - +]o posix"
	}

	if {($interactcom != 1 || $generateDefault) && [set version@bash(index)]} {
	    print "shopt -[pick $interactcom s u] interactive_comments"
	}

	### Command/script handling ###
	if {$verb || $generateDefault} {
	    print "set [pick $verb - +]o verbose"
	}

	if {$xtrac || $generateDefault} {
	    print "set [pick $xtrac - +]o xtrace"
	}

	if {($chkhash || $generateDefault) && [set version@bash(index)]} {
	    print "shopt -[pick $chkhash s u] checkhash"
	}

	### Shell termination ###
	if {$igneof != 10 || $generateDefault} {
	    if {$igneof != 10} {
		print "export IGNOREEOF=$igneof"
	    } {
		print "set -o ignoreeof"
	    }
	}

	if {$timeout > 0 || $generateDefault} {
	    print "[pick [expr $timeout > 1] "TMOUT=$timeout" "unset TMOUT"]"
	}

	### Miscellaneous variables ###
	if {$editor != "" || $generateDefault} {
	    print "export EDITOR='$editor'"
	}
    }
}