Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / man / man1 / pshcomplete.1
CommitLineData
86530b38
AT
1.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sh \" Subsection heading
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
13.de Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16..
17.de Vb \" Begin verbatim text
18.ft CW
19.nf
20.ne \\$1
21..
22.de Ve \" End verbatim text
23.ft R
24.fi
25..
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
32.tr \(*W-|\(bv\*(Tr
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34.ie n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
43'br\}
44.el\{\
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
49'br\}
50.\"
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
58..
59. nr % 0
60. rr F
61.\}
62.\"
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
66.if n .na
67.\"
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
70. \" fudge factors for nroff and troff
71.if n \{\
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
77.\}
78.if t \{\
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
84.\}
85. \" simple accents for nroff and troff
86.if n \{\
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
93.\}
94.if t \{\
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101.\}
102. \" troff and (daisy-wheel) nroff accents
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
112. \" corrections for vroff
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115. \" for low resolution devices (crt and lpr)
116.if \n(.H>23 .if \n(.V>19 \
117\{\
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
127.\}
128.rm #[ #] #H #V #F C
129.\" ========================================================================
130.\"
131.IX Title "PSHCOMPLETE 1"
132.TH PSHCOMPLETE 1 "2003-01-02" "perl v5.8.0" "User Contributed Perl Documentation"
133.SH "NAME"
134pshcomplete \- TAB completion in Perl Shell
135.SH "SYNOPSIS"
136.IX Header "SYNOPSIS"
137\&\s-1TAB\s0 completion strategies in Perl Shell
138.SH "DESCRIPTION"
139.IX Header "DESCRIPTION"
140\&\fBpsh\fR supports built-in completion support as well as a largely \fBbash\fR
141compatible user-programmable completion.
142.PP
143Whenever a user presses the \s-1TAB\s0 key, \fBpsh\fR first checks wether we're
144trying to complete a command for which there's a user-programmed completion.
145Please see below for further information about this process.
146.PP
147If there are no user-programmed completions, following default completion
148strategies are checked in the specified order:
149.IP "Perl Hash Keys" 4
150.IX Item "Perl Hash Keys"
151If the current expression looks like an attempt to enter the key of a
152Perl Hash ( \f(CW\*(C`$var{$keypart\*(C'\fR or \f(CW\*(C`$var\-\*(C'\fR{$keypart> ), \fBpsh\fR will examine
153the Perl symbol table to try to complete the entered key.
154.IP "Perl Methods" 4
155.IX Item "Perl Methods"
156Afterwards \fBpsh\fR will try to complete method calls which look like
157\&\f(CW\*(C`$obj\-\*(C'\fRmethodpart>.
158.IP "Perl Variables" 4
159.IX Item "Perl Variables"
160An attempt is then made to complete any perl variable names starting with
161one the most usual context signifiers ( \f(CW\*(C`@$%&\*(C'\fR or \f(CW$#\fR ).
162.IP "Executables" 4
163.IX Item "Executables"
164If the user is currently working on the first word of the line or a similar
165syntactic position (like the first word after a pipe sign), \fBpsh\fR attempts
166to find an executable in the current path matching the expression.
167.IP "Filenames" 4
168.IX Item "Filenames"
169If no completions could be generated so far, \fBpsh\fR will attempt to complete
170the word as a filename.
171.IP "Built-ins" 4
172.IX Item "Built-ins"
173Afterwards, \fBpsh\fR will check wether the command to execute is a builtin
174command. If yes, the builtin command is asked for a list of completions.
175The list of completions supplied by the builtin may or may not replace the
176list of so far gathered possible completions, depending on the builtin.
177.SH "PROGRAMMABLE COMPLETIONS"
178.IX Header "PROGRAMMABLE COMPLETIONS"
179.Sh "\s-1DESCRIPTION\s0"
180.IX Subsection "DESCRIPTION"
181This \f(CW\*(C`Psh::PCompletion\*(C'\fR module provides the programmable completion
182function almost compatible with the one of bash\-2.04 and/or later. The
183following document is based on the texinfo file of bash\-2.04\-beta5.
184.Sh "Programmable Completion"
185.IX Subsection "Programmable Completion"
186When word completion is attempted for an argument to a command for
187which a completion specification (a \s-1COMPSPEC\s0) has been defined using
188the \fBcomplete\fR builtin (See \*(L"Programmable Completion Builtins\*(R".),
189the programmable completion facilities are invoked.
190.PP
191First, the command name is identified. If a compspec has been defined
192for that command, the compspec is used to generate the list of
193possible completions for the word. If the command word is a full
194pathname, a compspec for the full pathname is searched for first. If
195no compspec is found for the full pathname, an attempt is made to find
196a compspec for the portion following the final slash.
197.PP
198Once a compspec has been found, it is used to generate the list of
199matching words. If a compspec is not found, the default Psh
200completion described above (Where is it described?) is performed.
201.PP
202First, the actions specified by the compspec are used. Only matches
203which are prefixed by the word being completed are returned. When the
204\&\fB\-f\fR or \fB\-d\fR option is used for filename or directory name
205completion, the shell variable \fB\s-1FIGNORE\s0\fR is used to filter the
206matches. See \*(L"\s-1ENVIRONMENT\s0 \s-1VARIABLES\s0\*(R" for a description of
207\&\fB\s-1FIGNORE\s0\fR.
208.PP
209Any completions specified by a filename expansion pattern to the \fB\-G\fR
210option are generated next. The words generated by the pattern need
211not match the word being completed. The \fB\s-1GLOBIGNORE\s0\fR shell variable
212is not used to filter the matches, but the \fB\s-1FIGNORE\s0\fR shell variable
213is used.
214.PP
215Next, the string specified as the argument to the \fB\-W\fR option is
216considered. The string is first split using the characters in the
217\&\fB\s-1IFS\s0\fR special variable as delimiters. Shell quoting is honored.
218Each word is then expanded using brace expansion, tilde expansion,
219parameter and variable expansion, command substitution, arithmetic
220expansion, and pathname expansion, as described above (Where is it
221described?). The results are split using the rules described above
222(Where is it described?). No filtering against the word being
223completed is performed.
224.PP
225After these matches have been generated, any shell function or command
226specified with the \fB\-F\fR and \fB\-C\fR options is invoked. When the
227function or command is invoked, the first argument is the word being
228completed, the second argument is the current command line, the third
229argument is the index of the current cursor position relative to the
230beginning of the current command line, and the fourth argument is the
231name of the command whose arguments are being completed. If the
232current cursor position is at the end of the current command, the
233value of the third argument is equal to the length of the second
234argument string.
235.PP
236No filtering of the generated completions against the word being
237completed is performed; the function or command has complete freedom
238in generating the matches.
239.PP
240Any function specified with \fB\-F\fR is invoked first. The function may
241use any of the shell facilities, including the \fBcompgen\fR builtin
242described below (See \*(L"Programmable Completion Builtins\*(R".), to
243generate the matches. It returns a array including the possible
244completions. For example;
245.PP
246.Vb 6
247\& sub _foo_func {
248\& my ($cur, $line, $start, $cmd) = @_;
249\& ...
250\& return @possible_completions;
251\& }
252\& complete -F _foo_func bar
253.Ve
254.PP
255Next, any command specified with the \fB\-C\fR option is invoked in an
256environment equivalent to command substitution. It should print a list
257of completions, one per line, to the standard output. Backslash may be
258used to escape a newline, if necessary.
259.PP
260After all of the possible completions are generated, any filter
261specified with the \fB\-X\fR option is applied to the list. The filter is
262a pattern as used for pathname expansion; a \f(CW\*(C`&\*(C'\fR in the pattern is
263replaced with the text of the word being completed. A literal \f(CW\*(C`&\*(C'\fR
264may be escaped with a backslash; the backslash is removed before
265attempting a match. Any completion that matches the pattern will be
266removed from the list. A leading \f(CW\*(C`!\*(C'\fR negates the pattern; in this
267case any completion not matching the pattern will be removed.
268.PP
269Finally, any prefix and suffix specified with the \fB\-P\fR and \fB\-S\fR
270options are added to each member of the completion list, and the
271result is returned to the Readline completion code as the list of
272possible completions.
273.PP
274If a compspec is found, whatever it generates is returned to the
275completion code as the full set of possible completions. The default
276Bash completions are not attempted, and the Readline default of
277filename completion is disabled.
278.Sh "Programmable Completion Builtins"
279.IX Subsection "Programmable Completion Builtins"
280A builtin commands \fBcomplete\fR and a builtin Perl function \fBcompgen\fR
281are available to manipulate the programmable completion facilities.
282.IP "\fBcompgen\fR" 4
283.IX Item "compgen"
284.Vb 1
285\& compgen [OPTION] [WORD]
286.Ve
287.Sp
288Generate possible completion matches for \fI\s-1WORD\s0\fR according to the
289\&\fI\s-1OPTION\s0\fRs, which may be any option accepted by the \fBcomplete\fR builtin
290with the exception of \fB\-p\fR and \fB\-r\fR, and write the matches to the
291standard output. When using the \fB\-F\fR or \fB\-C\fR options, the various
292shell variables set by the programmable completion facilities, while
293available, will not have useful values.
294.Sp
295The matches will be generated in the same way as if the programmable
296completion code had generated them directly from a completion
297specification with the same flags. If \fI\s-1WORD\s0\fR is specified, only
298those completions matching \fI\s-1WORD\s0\fR will be displayed.
299.Sp
300The return value is true unless an invalid option is supplied, or no
301matches were generated.
302.IP "\fBcomplete\fR" 4
303.IX Item "complete"
304.Vb 4
305\& complete [-abcdefjkvu] [-A ACTION] [-G GLOBPAT] [-W WORDLIST]
306\& [-P PREFIX] [-S SUFFIX] [-X FILTERPAT] [-x FILTERPAT]
307\& [-F FUNCTION] [-C COMMAND] NAME [NAME ...]
308\& complete -pr [NAME ...]
309.Ve
310.Sp
311Specify how arguments to each \fI\s-1NAME\s0\fR should be completed. If the
312\&\fB\-p\fR option is supplied, or if no options are supplied, existing
313completion specifications are printed in a way that allows them to be
314reused as input. The \fB\-r\fR option removes a completion specification
315for each \fI\s-1NAME\s0\fR, or, if no \fI\s-1NAME\s0\fRs are supplied, all completion
316specifications.
317.Sp
318The process of applying these completion specifications when word
319completion is attempted is described above (See \*(L"Programmable Completion\*(R".).
320.Sp
321Other options, if specified, have the following meanings. The
322arguments to the \fB\-G\fR, \fB\-W\fR, and \fB\-X\fR options (and, if necessary,
323the \fB\-P\fR and \fB\-S\fR options) should be quoted to protect them from
324expansion before the \fBcomplete\fR builtin is invoked.
325.RS 4
326.IP "\fB\-A\fR \fI\s-1ACTION\s0\fR" 4
327.IX Item "-A ACTION"
328The \fI\s-1ACTION\s0\fR may be one of the following to generate a list of
329possible completions:
330.RS 4
331.IP "\fBalias\fR" 4
332.IX Item "alias"
333Alias names. May also be specified as \fB\-a\fR.
334.IP "\fBarrayvar\fR" 4
335.IX Item "arrayvar"
336Names of Perl array variable names.
337.IP "\fBbinding\fR" 4
338.IX Item "binding"
339Readline key binding names.
340.IP "\fBbuiltin\fR" 4
341.IX Item "builtin"
342Names of shell builtin commands. May also be specified as \fB\-b\fR.
343.IP "\fBcommand\fR" 4
344.IX Item "command"
345Command names. May also be specified as \fB\-c\fR.
346.IP "\fBdirectory\fR" 4
347.IX Item "directory"
348Directory names. May also be specified as \fB\-d\fR.
349.IP "\fBdisabled\fR" 4
350.IX Item "disabled"
351Names of disabled shell builtins (not implemented yet.).
352.IP "\fBenabled\fR" 4
353.IX Item "enabled"
354Names of enabled shell builtins (not implemented yet.).
355.IP "\fBexport\fR" 4
356.IX Item "export"
357Names of exported shell variables. May also be specified as \fB\-e\fR.
358.IP "\fBfile\fR" 4
359.IX Item "file"
360File names. May also be specified as \fB\-f\fR.
361.IP "\fBfunction\fR" 4
362.IX Item "function"
363Names of Perl functions.
364.IP "\fBhashvar\fR" 4
365.IX Item "hashvar"
366Names of Perl hash variable names.
367.IP "\fBhelptopic\fR" 4
368.IX Item "helptopic"
369Help topics as accepted by the `help' builtin.
370.IP "\fBhostname\fR" 4
371.IX Item "hostname"
372Hostnames.
373.IP "\fBjob\fR" 4
374.IX Item "job"
375Job names, if job control is active. May also be specified as \fB\-j\fR.
376.IP "\fBkeyword\fR" 4
377.IX Item "keyword"
378Shell reserved words. May also be specified as \fB\-k\fR.
379.IP "\fBrunning\fR" 4
380.IX Item "running"
381Names of running jobs, if job control is active.
382.IP "\fBsetopt\fR" 4
383.IX Item "setopt"
384Valid arguments for the \fB\-o\fR option to the \fBset\fR builtin (not
385implemented yet.).
386.IP "\fBshopt\fR" 4
387.IX Item "shopt"
388Shell option names as accepted by the \fBshopt\fR builtin (not
389implemented yet.).
390.IP "\fBsignal\fR" 4
391.IX Item "signal"
392Signal names.
393.IP "\fBstopped\fR" 4
394.IX Item "stopped"
395Names of stopped jobs, if job control is active.
396.IP "\fBuser\fR" 4
397.IX Item "user"
398User names. May also be specified as \fB\-u\fR.
399.IP "\fBvariable\fR" 4
400.IX Item "variable"
401Names of all Perl variables. May also be specified as \fB\-v\fR.
402.RE
403.RS 4
404.RE
405.IP "\fB\-G\fR \fI\s-1GLOBPAT\s0\fR" 4
406.IX Item "-G GLOBPAT"
407The filename expansion pattern \fI\s-1GLOBPAT\s0\fR is expanded to generate the
408possible completions.
409.IP "\fB\-W\fR \fI\s-1WORDLIST\s0\fR" 4
410.IX Item "-W WORDLIST"
411The \fI\s-1WORDLIST\s0\fR is split using the characters in the \fB\s-1IFS\s0\fR special
412variable as delimiters, and each resultant word is expanded. The
413possible completions are the resultant list.
414.IP "\fB\-C\fR \fI\s-1COMMAND\s0\fR" 4
415.IX Item "-C COMMAND"
416\&\fI\s-1COMMAND\s0\fR is executed in a subshell environment, and its output is
417used as the possible completions.
418.IP "\fB\-F\fR \fI\s-1FUNCTION\s0\fR" 4
419.IX Item "-F FUNCTION"
420The shell function \fI\s-1FUNCTION\s0\fR is executed in the current Perl shell
421environment. When it finishes, the possible completions are retrieved
422from the array which the function returns.
423.IP "\fB\-X\fR \fI\s-1FILTERPAT\s0\fR" 4
424.IX Item "-X FILTERPAT"
425\&\fI\s-1FILTERPAT\s0\fR is a pattern as used for filename expansion. It is
426applied to the list of possible completions generated by the preceding
427options and arguments, and each completion matching \fI\s-1FILTERPAT\s0\fR is
428removed from the list. A leading \f(CW\*(C`!\*(C'\fR in \fI\s-1FILTERPAT\s0\fR negates the
429pattern; in this case, any completion not matching \fI\s-1FILTERPAT\s0\fR is
430removed.
431.IP "\fB\-x\fR \fI\s-1FILTERPAT\s0\fR" 4
432.IX Item "-x FILTERPAT"
433Similar to the \fB\-X\fR option above, except it is applied to only
434filenames not to directory names etc.
435.IP "\fB\-P\fR \fI\s-1PREFIX\s0\fR" 4
436.IX Item "-P PREFIX"
437\&\fI\s-1PREFIX\s0\fR is added at the beginning of each possible completion after
438all other options have been applied.
439.IP "\fB\-S\fR \fI\s-1SUFFIX\s0\fR" 4
440.IX Item "-S SUFFIX"
441\&\fI\s-1SUFFIX\s0\fR is appended to each possible completion after all other
442options have been applied.
443.RE
444.RS 4
445.Sp
446The return value is true unless an invalid option is supplied, an
447option other than \fB\-p\fR or \fB\-r\fR is supplied without a \fI\s-1NAME\s0\fR
448argument, an attempt is made to remove a completion specification for
449a \fI\s-1NAME\s0\fR for which no specification exists, or an error occurs adding
450a completion specification.
451.RE
452.Sh "\s-1AUTHOR\s0"
453.IX Subsection "AUTHOR"
454Hiroo Hayashi, hiroo.hayashi@computer.org
455.Sh "\s-1SEE\s0 \s-1ALSO\s0"
456.IX Subsection "SEE ALSO"
457info manual of bash\-2.04 and/or later
458.Sh "\s-1EXAMPLES\s0"
459.IX Subsection "EXAMPLES"
460\&\fIcomplete_example\fR in the Psh distribution shows you many examples of
461the usage of programmable completion.
462.PP
463.Vb 1
464\& source complete-examples
465.Ve
466.SH "COPYRIGHT"
467.IX Header "COPYRIGHT"
468Copyright (C) 1999\-2003 Gregor N. Purdy. All rights reserved.
469This script is free software. It may be copied or modified according
470to the same terms as Perl itself.