ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/doc/tex/manual/Appendix.tex
Revision: 1.3
Committed: Tue Nov 8 13:28:28 2005 UTC (19 years, 6 months ago) by sashby
Content type: application/x-tex
Branch: MAIN
CVS Tags: V1_0_3-p4, forV1_1_0, v103_xml_071106, V1_0_3-p3, V1_0_3-p2, V110p3, V110p2, V110p1, V1_0_4p1, V1_0_3-p1, V1_0_3, V1_0_2
Branch point for: v200branch, v103_with_xml, v103_branch
Changes since 1.2: +30 -12 lines
Log Message:
More doc updates, add ReleaseNotes

File Contents

# Content
1 %%____________________________________________________________________
2 %% File: Appendix.tex
3 %%____________________________________________________________________
4 %%
5 %% Author: Shaun ASHBY <Shaun.Ashby@cern.ch>
6 %% Update: 2005-11-02 17:11:52+0100
7 %% Revision: $Id: Appendix.tex,v 1.2 2005/11/07 14:30:19 sashby Exp $
8 %%
9 %% Copyright: 2005 (C) Shaun ASHBY
10 %%
11 %%--------------------------------------------------------------------
12 \chapter{Appendix}\label{ch:appendix}
13
14 \section{\scram\ Function for the ZSH Completion System}
15
16 For all users of \texttt{zsh}, a completion function can be defined
17 for \scram\ so that command and option completion is possible. The
18 completion function below should be saved as \texttt{\_scram}
19 somewhere in a user directory. For it to be found by \texttt{zsh}, a
20 path variable called \texttt{fpath} must be defined in
21 \texttt{.zshenv} or \texttt{.zshrc} to include the
22 system-wide \texttt{fpath} and the user one. For example, if the
23 completion function was located in a directory called
24 \texttt{compfunc} in the user home directory, the following statement
25 \begin{verbatim}
26 fpath=(\$fpath \$HOME/compfunc)
27 \end{verbatim}
28 must be made in the \texttt{zsh} startup files. Note that you may also
29 need to activate the completion system by adding
30 \begin{verbatim}
31 autoload -U compinit
32 compinit
33 \end{verbatim}
34 to your \texttt{.zshrc}.
35
36 \ni The completion function is included below in full but can be copied from the
37 \texttt{scripts} directory in the \scram\ source tree.
38
39 \paragraph{\scram\ completion function}
40 \small{
41 \begin{verbatim}
42 #compdef scram
43 # $Id: _scram,v 1.6 2005/03/24 17:17:06 sashby Exp $
44 #
45 _scram()
46 {
47 _arguments -s \
48 '-h[show help]' \
49 '-v[version]' \
50 '-d[debug mode]' \
51 '-n[no return]' \
52 '-arch:supported architectures:(rh73_gcc323 slc3_ia32_gcc323 slc3_ia32_gcc323_dbg osx103_gcc33)' \
53 '*::scram command:_scram_command'
54 }
55
56 (( $+functions[_scram_command] )) ||
57 _scram_command ()
58 {
59 local _scram_cmds
60 _scram_cmds=(version arch setup runtime build list project tool \
61 install remove db config urlget gui xmlmigrate)
62
63 if (( CURRENT == 1 )); then
64 _tags _scram_cmds && { compadd "$@" -a _scram_cmds }
65 else
66 local curcontext="$curcontext"
67 cmd="$words[1]"
68 if (( $#cmd )); then
69 curcontext="${curcontext%:*:*}:scram-${cmd}:"
70 _scram_$cmd
71 else
72 _message "unknown scram command: $words[1]"
73 fi
74 fi
75 }
76
77 (( $+functions[_scram_version] )) ||
78 _scram_version()
79 {
80 _arguments -s \
81 '-h[show help for the version command]:print help for this command' \
82 '-c[show CVS parameters for SCRAM downloads]' \
83 '-i[show CVS commit information]' \
84 '*::specify a version to download:(V1_0_0 V1_0_1 V1_0_2)'
85 }
86
87 (( $+functions[_scram_arch] )) ||
88 _scram_arch()
89 {
90 _arguments -s \
91 '-h[show help for the arch command]:print help for this command'
92 }
93
94 (( $+functions[_scram_setup] )) ||
95 _scram_setup()
96 {
97 # scram setup [-i] [-f tools.conf] [toolname] [[version] [url]]
98 _arguments -s \
99 - set1 \
100 '-h[show help for the setup command]:print help for this command' \
101 - set2 \
102 '-i[interactive setup mode]' \
103 '-f[file for tool default settings]:tool config defaults:_files -g \*.conf' \
104 "*::tool list:_scram_tools_and_versions"
105 }
106
107 (( $+functions[_scram_runtime] )) ||
108 _scram_runtime()
109 {
110 _arguments -s \
111 - set1 \
112 '-h[show help for the runtime command]:print help for this command' \
113 - set2 \
114 '(-c -w)-s[Bourne-like shell environment]' \
115 '(-s -w)-c[TCSH shell environment]' \
116 '(-c -s)-w[Win32 shell environent]' \
117 '-d[dump the current environment]:filename' \
118 - set3 \
119 '(-c -w)-s[Bourne-like shell environment]' \
120 '(-s -w)-c[TCSH shell environment]' \
121 '(-c -s)-w[Win32 shell environent]' \
122 '-f:read an environment from a file:_files -g \*.env'
123 }
124
125 (( $+functions[_scram_tool] )) ||
126 _scram_tool()
127 {
128 local expl
129 _arguments -s \
130 '-h[show help for the tool command]:print help for this command'
131
132 if (( $CURRENT == 2 )); then
133 local tooltags
134 tooltags=(list info tag remove template)
135 _wanted cmds expl 'tool sub-command' compadd -a tooltags
136 elif (( $CURRENT == 3 )); then
137 local _scramtools
138 typeset -gA _scramtools
139
140 if (( ! $#_scramtools )); then
141 _scramtools=($(_call_program commands scram tool list | grep "^ " 2>&1))
142 fi
143
144 case "$words[2]" in
145 list)
146 _message 'list configured tools'
147 ;;
148 info|remove|tag)
149 if (( $#_scramtools )); then
150 _wanted tools expl 'list of configured tools' compadd ${(k)_scramtools}
151 else
152 _message 'No tools: probably not in a project area'
153 fi
154 ;;
155 template)
156 local tmpltypes
157 tmpltypes=(compiler basic)
158 _wanted tmpl expl 'template type to download' compadd -a tmpltypes
159 ;;
160 esac
161 elif (( $CURRENT == 4 )); then
162 local _toolstags
163
164 if (( ! $#_toolstags )); then
165 _toolstags=($(_call_program commands scram tool tag $words[3] 2>&1))
166 fi
167 _wanted ttags expl "tags defined for $words[3]" compadd -a _toolstags
168 fi
169 }
170
171 (( $+functions[_scram_build] )) ||
172 _scram_build()
173 {
174 local makeopts
175 makeopts=(
176 '-n[print the commands that would be executed but do not run them]'
177 '--printdir[print the working directory before and after entering it]'
178 '--printdb[print the data base of rules after scanning makefiles, then build as normal]'
179 '-j[the number of processes to run simultaneously]'
180 '-k[continue for as long as possible after an error]'
181 '-s[do not print any output]'
182 '-d[run gmake in debug mode]'
183 )
184
185 _arguments -s \
186 '-h[show help for the build command]:print help for this command' \
187 '-v[show compilation command]' \
188 '-r[reset cache]' \
189 '-f[skip cache scan]' \
190 '-t[dry run]' \
191 '-w-[graphing mode type]:graphing mode:_scram_graphing' \
192 '--xmlb[Read XML BuildFiles]' \
193 "$makeopts[@]" \
194 '*::targets:(release release-build shared bin test)'
195 }
196
197 (( $+functions[_scram_list] )) ||
198 _scram_list()
199 {
200 _arguments -s \
201 '-h[show help for the list command]:print help for this command' \
202 '-c[show a compact list]' \
203 '-o[use old-style listing (i.e. all projects)]' \
204 '*::SCRAM project:_scram_projects_and_versions'
205 }
206
207 (( $+functions[_scram_project] )) ||
208 _scram_project()
209 {
210 # scram project [-t] [-d <area>] [-n <dir>] [-f <tools.conf>] <projecturl> [<projectversion>]
211 _arguments \
212 - set1 \
213 '-h[show help for the project command]:print help for this command' \
214 - set2 \
215 '-t[download project templates]:download project templates' \
216 - set3 \
217 '-f:file for tool defaults:_files -g \*.conf' \
218 '-b[bootstrap files]:bootstrap:_files -g conf\*/boot\*' \
219 - set4 \
220 '-d:installation directory:_files -/' \
221 '-n[area name]:area name' \
222 '*:::SCRAM project:_scram_projects_and_versions'
223 }
224
225 (( $+functions[_scram_install] )) ||
226 _scram_install()
227 {
228 _arguments -s \
229 '-h[show help for the install command]:print help for this command' \
230 '-f[force the installation]' \
231 '*:::optional project label and version'
232 }
233
234 (( $+functions[_scram_remove] )) ||
235 _scram_remove()
236 {
237 _arguments -s \
238 '-h[show help for the remove command]:print help for this command' \
239 '-f[force the installation]' \
240 '*:::SCRAM project:_scram_projects_and_versions'
241 }
242
243 (( $+functions[_scram_db] )) ||
244 _scram_db()
245 {
246 _arguments -s \
247 '-h[show help for the db command]:print help for this command' \
248 '-link[link to a SCRAM database]:linkdb:_files -g \*\*/project.lookup' \
249 '-unlink[remove linked SCRAM databases]:removedb:_scram_db_unlink' \
250 '-show[show linked SCRAM databases]'
251 }
252
253 (( $+functions[_scram_config] )) ||
254 _scram_config()
255 {
256 _arguments -s \
257 '-h[show help for the config command]:print help for this command' \
258 '-t[dump list of configured tools]' \
259 '-f[dump tools and project config]'
260 }
261
262 (( $+functions[_scram_urlget] )) ||
263 _scram_urlget()
264 {
265 _arguments -s \
266 '-h[show help for the urlget command]:print help for this command' \
267 '*::specify a scram document URL:( http:// file: cvs:// )'
268 }
269
270 (( $+functions[_scram_gui] )) ||
271 _scram_gui()
272 {
273 _arguments -s \
274 '-h[show help for the gui command]:print help for this command' \
275 '-e[edit metadata]' \
276 '-s[show metadata information]' \
277 '*::metadata type:(tool compiler)'
278 }
279
280 (( $+functions[_scram_xmlmigrate] )) ||
281 _scram_xmlmigrate()
282 {
283 _arguments -s \
284 '-h[show help for the xmlmigrate command]:print help for this command'
285 }
286
287 ############# Auxiliary functions ##############
288
289 (( $+functions[_scram_tools_and_versions] )) ||
290 _scram_tools_and_versions()
291 {
292 local _scramtools expl
293 typeset -gA _scramtools
294
295 if (( ! $#_scramtools )); then
296 _scramtools=($(_call_program commands scram tool list | grep "^ " 2>&1))
297 fi
298
299 if (( $CURRENT == 2 )); then
300 if (( $#_scramtools )); then
301 local _version
302 _version=(${_scramtools[$words[1]]})
303 _wanted projectver expl 'select tool version' compadd -a _version
304 else
305 _message 'No tools: probably not in a project area'
306 fi
307 elif (( $CURRENT == 3 )); then
308 local _urls
309 _urls=(http:// cvs:// file:./)
310 _wanted urls expl 'ToolDoc URLs' compadd $_urls
311 else
312 if (( $#_scramtools )); then
313 _wanted tools expl 'configured tools' compadd ${(k)_scramtools}
314 else
315 _message 'No tools: probably not in a project area'
316 fi
317 fi
318 }
319
320 (( $+functions[_scram_db_unlink] )) ||
321 _scram_db_unlink()
322 {
323 local expl
324
325 _dbs=( $(_call_program dbs scram db -show | grep lookup | grep -v Current 2>/dev/null) )
326
327 if (( $#_dbs ));then
328 _wanted scramdb expl 'remove database' compadd -a _dbs
329 else
330 _message 'No databases linked'
331 fi
332 }
333
334 (( $+functions[_scram_graphing] )) ||
335 _scram_graphing()
336 {
337 local opts
338 opts=('package' 'global')
339 _wanted graph-mode expl 'graphing mode' compadd -P '=' $opts
340 }
341
342 (( $+functions[_scram_projects_and_versions] )) ||
343 _scram_projects_and_versions()
344 {
345 local expl _projects _versions
346
347 if (( $CURRENT == 2 )); then
348 _versions=( $(_call_program pversions scram l -c $words[1] \
349 | awk '{print $2}' |sort|uniq 2>/dev/null) )
350 _wanted projectver expl 'select project version' compadd -a _versions
351 else
352 _projects=( $(_call_program pversions scram l -c | awk '{print $1}' |sort|uniq 2>/dev/null) )
353 if (( $#_projects )); then
354 _wanted projects expl 'SCRAM project' compadd -a _projects
355 else
356 _message 'No installed projects'
357 fi
358 fi
359 }
360
361 ################ Main ###################
362 # Run the function with args passed down:
363 #########################################
364 _scram "$@"
365
366 \end{verbatim}}\normalsize
367
368 %%% Local Variables:
369 %%% mode: latex
370 %%% TeX-master: "SCRAM-manual"
371 %%% End:
372
373 %%____________________________________________________________________
374 %% End of Appendix.tex
375 %%____________________________________________________________________
376 %%