diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-11-01 06:58:18 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-11-01 07:23:49 +0100 |
commit | 9f6cba5c0370aee2f9803abbc35ab7e67f57ee84 (patch) | |
tree | b03485f177d6ff700aac7fc8ff1e7e9e23a61866 /doc/sciteco.7.template | |
parent | b5e6f4c61b7b8e220fb3faa071e30b3dfc559f2f (diff) | |
download | sciteco-9f6cba5c0370aee2f9803abbc35ab7e67f57ee84.tar.gz |
globbing supports character classes now and ^EN string building construct to escape glob patterns
* globbing is fnmatch(3) compatible, now on every supported platform.
* which means that escaping of glob patterns is possible now.
^ENq has been introduced to ease this task.
* This finally allows you to pass unmodified filenames to EB.
Previously it was impossible to open file names containing glob wildcards.
* this was achieved by moving from GPattern to GRegex as the underlying
implementation.
* The glob pattern is converted to a regular expression before being
compiled to a GRegex.
This turned out to be trickier than anticipated (~140 lines of code)
and has a runtime penalty of course (complexity is O(2*n) over the
pattern length).
It is IMHO still better than the alternatives, like importing
external code from libiberty, which is potentially non-cross-platform.
* Using GRegex also opens the potential of supporting brace "expansions"
later in the form of glob pattern constructs
(they won't actually expand but match alternatives).
* is_glob_pattern() has been simplified and moved to Globber::is_pattern().
It makes sense to reuse the Globber class namespace instead of using
plain functions for functions working on glob patterns.
* The documentation has a new subsection on glob patterns now.
* Testsuite extended with glob pattern test cases
Diffstat (limited to 'doc/sciteco.7.template')
-rw-r--r-- | doc/sciteco.7.template | 58 |
1 files changed, 54 insertions, 4 deletions
diff --git a/doc/sciteco.7.template b/doc/sciteco.7.template index 6ed89db..9bf0cc0 100644 --- a/doc/sciteco.7.template +++ b/doc/sciteco.7.template @@ -1466,7 +1466,7 @@ Expands to the string contents of the Q-Register specified by \fIq\fP. .TP .BI ^E@ q -Expands to the quoted string contents of the Q-Register +Expands to the shell-quoted string contents of the Q-Register specified by \fIq\fP. The quoting will be such that an UNIX98 \(lq/bin/sh\(rq will interpret the quoted string like the original contents of @@ -1475,6 +1475,14 @@ This is useful when generating UNIX shell code or when passing registers with unknown contents as parameters to external commands using the \fBEC\fP command. .TP +.BI ^EN q +Expands to the string contents of the Q-Register specified +by \fIq\fP but with glob pattern wildcards escaped. +This is useful for commands accepting glob patterns to +pass file names which will not be interpreted further +(e.g. if the file name may contain \(lq*\(rq or other +special characters). +.TP .BI ^E c All remaining \fB^E\fP combinations are passed down unmodified. @@ -1624,15 +1632,57 @@ user's\fP home directory using the value of the \(lq$HOME\(rq environment register. Thus the \(lq~\fIusername\fP\(rq syntax is \fBnot\fP supported. .LP -Last but not least, some commands accept glob patterns -in their file name arguments to refer to multiple files at once -(see \fBEN\fP command). There is special immediate editing command support for file and directory path arguments (e.g. tab-completions and specialized rub-out/rub-in commands). These are documented in the section .BR "COMMANDLINE EDITING" . . +.SS Glob Patterns +. +Some commands accept glob patterns +in their file name arguments to perform pattern matching +on arbitrary strings or to work with multiple existing files +(see \fBEN\fP and \fBEB\fP commands). +\*(ST glob patterns mimic the POSIX +.BR fnmatch (3) +syntax, but work uniformly across all platforms. +The following wildcard constructs are supported: +.TP +.B * +Matches an arbitary number of characters or no character +at all. +.TP +.B ? +Matches a single arbitrary character. +.TP +.BI [ set ] +Matches one character in the given character \fIset\fP. +For instance \(lq[ch]\(rq matches both \(lqc\(rq and \(lqh\(rq. +A hyphen may be used to specify character ranges as in +\(lq[0-9]\(rq to match all decimal digits. +Within a character class, the \(lq*\(rq and \(lq?\(rq wildcards +have no special meanings and represent their corresponding +characters. +To include a hypen in the \fIset\fP, write it first or last. +To include a closing bracket in the \fIset\fP, write it first, +as in \(lq[]ch]\(rq. +.TP +.BI [^ set ] +.TQ +.BI [! set ] +Matches one character which is \fBnot\fP in the given character +\fIset\fP. +Otherwise behaves exactly like \fB[\fIset\fB]\fR. +.LP +All other characters match themselves. +Brackets can be used to escape wildcard characters. +For instance, \(lq[*]\(rq may be used to match a literal asterisk. +To facilitate passing filenames verbatim to commands +accepting glob patterns, there is the \fB^EN\fIq\fR string +building construct which automatically escapes glob pattern +wildcards. +. . .SH FLOW CONTROL . |