You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In elvish, wildcards can be modified using the indexing operator []. Right now there is only an all wildcard modifier that makes wildcards match dots in the beginning of filenames. For instance, echo *[all] lists all files in the current directory, including those whose names start with a dot.
Another potential candidate for modifier is the traditional character set and range specification, as in echo [aeiou], which matches files whose names consist of a single vowel, and echo [a-z], which matches file whose names consist of a single lower case letter (let's pretend diacritics do not exist). However, square brackets are already used for list and map literals in elvish. Instead we could implement this as a wildcard modifier: echo ?[aeiou]. This gives character ranges more power: now you can also write echo *[aeiou] to match files whose names consist of any number of vowels.
However, the proposal above conflicts with our current modifier all: if it were to be implemented, *[all] will stand for files whose names consist of letters a and l. (We could make a special case for all, since you shouldn't write two l's, but I detest this kind of special casing.) We need to find a syntax to accommodate both our current "match all" functionality and the character set and range functionality.
There is also "character class" in traditional wildcards that look like [[:digit:]], that we also want to include. We can make all a special character class and therefore share its syntax.
For the choice of syntax, we propose the following possibilities:
Mimic POSIX, sets and ranges being "bare" and classes needing additional square brackets. Character set is [aeiou], range is [a-z], and class is [[:digit:]]. They may be combined: [[:digit:] aeiou a-z] (the space between aeiou and a-z is not mandatory). Elvish is different in that it requires a leading ?, * or **, of course.
Make classes "bare" and make sets and ranges "special classes", one possible syntax being: class is [digit], set is [set:aeiou], and range is [range:a-z]. They may be combined: [digit set:aeiou range:x-z].
The text was updated successfully, but these errors were encountered:
In elvish, wildcards can be modified using the indexing operator
[]
. Right now there is only anall
wildcard modifier that makes wildcards match dots in the beginning of filenames. For instance,echo *[all]
lists all files in the current directory, including those whose names start with a dot.Another potential candidate for modifier is the traditional character set and range specification, as in
echo [aeiou]
, which matches files whose names consist of a single vowel, andecho [a-z]
, which matches file whose names consist of a single lower case letter (let's pretend diacritics do not exist). However, square brackets are already used for list and map literals in elvish. Instead we could implement this as a wildcard modifier:echo ?[aeiou]
. This gives character ranges more power: now you can also writeecho *[aeiou]
to match files whose names consist of any number of vowels.However, the proposal above conflicts with our current modifier
all
: if it were to be implemented,*[all]
will stand for files whose names consist of lettersa
andl
. (We could make a special case forall
, since you shouldn't write two l's, but I detest this kind of special casing.) We need to find a syntax to accommodate both our current "match all" functionality and the character set and range functionality.There is also "character class" in traditional wildcards that look like
[[:digit:]]
, that we also want to include. We can makeall
a special character class and therefore share its syntax.For the choice of syntax, we propose the following possibilities:
Mimic POSIX, sets and ranges being "bare" and classes needing additional square brackets. Character set is
[aeiou]
, range is[a-z]
, and class is[[:digit:]]
. They may be combined:[[:digit:] aeiou a-z]
(the space betweenaeiou
anda-z
is not mandatory). Elvish is different in that it requires a leading?
,*
or**
, of course.Make classes "bare" and make sets and ranges "special classes", one possible syntax being: class is
[digit]
, set is[set:aeiou]
, and range is[range:a-z]
. They may be combined:[digit set:aeiou range:x-z]
.The text was updated successfully, but these errors were encountered: