System queries with Lua: l3sys-query

David Carlisle d.p.carlisle at
Thu Mar 7 10:13:02 CET 2024

On Thu, 7 Mar 2024 at 08:20, Joseph Wright <joseph at> wrote:

> > - In the --help, please explain what a <spec> is. Or use <glob>,
> > and then explain that [...] is not supported (I gather).
> There are two reasons here. First, I imagine that over time we might
> want a more general 'thing' here rather than just a glob. For a start, I
> suspect allowing a Lua pattern might be handy. I see Git uses "[<args>]"
> here - would that make sense? (I'll hold off making a change until you
> are David, at least, say this reads OK.)
> Second, coming from a Windows background, the "[...]" syntax at the
> command line is entire alien. So to me it's a gap I don't see. More
> immediately, the code we have used to convert globs to patterns needs
> about 30 lines for the */? setup and about 70 for "[...]". At the time
> we set that up for l3build, the balance felt like it made more sense to
> avoid "[...]". If we need it, we can add it - it's just a question of
> copy-pasting some MIT-licensed code.

This was in fact the first thing I tried when we had a first sketch, I use
file globs all the time
however the code to convert something close to  a bash glob to a lua
pattern is relatively complicated
and would form a large part of the whole package. For most of the intended
audience probably the simple
* wildcard we have now, plus the exclude list probably covers all cases
--exclude '*.bak'  ls '*'
lists all files except .bak files. So I think this is OK (although possibly
we shouldn't call them globs)

As Joseph just said, if people need more extensive filtering it would be
completely trivial to allow a Lua pattern
to filter the filename (as that's what's happening anyway) so  -pattern
'%d%d%d%d.tex' ls  to list all tex files
that have a basename of 4 digits. The extra complication to allow a shell
glob syntax and convert to a Lua pattern doesn't
seem worth it (and there would always be some more exotic shell syntax that
isn't supported)


n 06/03/2024 23:02, Karl Berry wrote:
>      --all enables .files in the current directory being read.
> Not just .files, also .dirs and (I presume) .whatevers.

Yes, the help says:
     Include 'dot' entries in directory listing
to cover that. Also applies when using --recursive

> Anyway, what confused me was that . and .. were not reported with --all.
> I expected them to show up, by analogy with ls -a, but it makes sense
> that they're omitted.

I think the handling of dotfiles (and the interaction with open_in) isn't
well specified currently and I don't think either what the current script
does (or what texosquery does) is the most natural in all combinations.
Hopefully we'll have a longer reply just on that topic after some more
testing, probably later today.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the tex-live mailing list.