1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
%%
%% This is file `l3sys-query.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% l3sys-query.dtx (with options: `package')
%%
%% This is a generated file.
%%
%% The source is maintained by the LaTeX Project team and bug
%% reports for it can be opened at https://latex-project.org/bugs/
%% (but please observe conditions on bug reports sent to that address!)
%%
%% Copyright (C) 1993-2024
%% The LaTeX Project and any individual authors listed elsewhere
%% in this file.
%%
%% This file was generated from file(s) of the Standard LaTeX `Tools Bundle'.
%% --------------------------------------------------------------------------
%%
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% https://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This file may only be distributed together with a copy of the LaTeX
%% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle'
%% without such generated files.
%%
%% The list of all files belonging to the LaTeX `Tools Bundle' is
%% given in the file `manifest.txt'.
%%
%% Source File: l3sys-query.dtx
%% Copyright (C) 2024
%%
%% The LaTeX Project and any individual authors listed elsewhere
%% in this file.
%%
%% This file may be distributed under the terms of the LPPL.
%% See README for details.
\ProvidesPackage{l3sys-query}
[2024-03-28 v1.0a LaTeX2e interface for l3sys file queries]
\ExplSyntaxOn
\sys_if_shell:F{
\PackageWarningNoLine{l3sys-query}
{Shell ~Escape ~is ~disabled.\MessageBreak All ~queries ~will ~return ~empty ~results}
}
\NewDocumentCommand\QueryWorkingDirectory {m} {
\sys_get_query:nN {pwd} #1
}
\tl_new:N\l_query_percent_tl
\tl_new:N\l_query_tilde_tl
\NewDocumentCommand\QueryFiles {} {
\group_begin:
\char_set_catcode_other:N \%
\char_set_catcode_other:N \^
\QueryFiles_inner
}
\char_set_catcode_active:N \~
\NewDocumentCommand\QueryFiles_inner {O{}m}{
\group_end:
\tl_set:Nn\l_tmpa_tl{}
\cs_set_eq:NN \l_query_percent_tl \%
\cs_set_eq:NN \% \c_percent_str
\cs_set_eq:NN \l_query_tilde_tl ~
\cs_set_eq:NN ~ \c_tilde_str
\keys_set:nn{QueryFiles}{#1}
\exp_args:NnV\sys_split_query:nnnN {ls} \l_tmpa_tl {#2} \l_tmpa_seq
\cs_set_eq:NN \% \l_query_percent_tl
\cs_set_eq:NN ~ \l_query_tilde_tl
\seq_map_inline:Nn\l_tmpa_seq
}
\NewDocumentCommand\QueryFilesTF {} {
\group_begin:
\char_set_catcode_other:N \%
\QueryFilesTF_inner
}
\NewDocumentCommand\QueryFilesTF_inner {O{}m}{
\group_end:
\tl_set:Nn\l_tmpa_tl{}
\cs_set_eq:NN \l_query_percent_tl \%
\cs_set_eq:NN \% \c_percent_str
\cs_set_eq:NN \l_query_tilde_tl ~
\cs_set_eq:NN ~ \c_tilde_str
\keys_set:nn{QueryFiles}{#1}
\exp_args:NnV\sys_split_query:nnnN {ls} \l_tmpa_tl {#2} \l_tmpa_seq
\cs_set_eq:NN \% \l_query_percent_tl
\cs_set_eq:NN ~ \l_query_tilde_tl
\seq_if_empty:NTF \l_tmpa_seq \use_iii:nnn \__queryfiles_aux:nnn
}
\char_set_catcode_space:N \~
\cs_new:Npn \__queryfiles_aux:nnn #1#2#3 {
#2
\seq_map_inline:Nn\l_tmpa_seq {#1}
}
\keys_define:nn {QueryFiles} {
recursive .code:n =\tl_put_right:Nn \l_tmpa_tl {--recursive ~ } ,
recursive .value_forbidden:n = true ,
ignore-case .code:n =\tl_put_right:Nn \l_tmpa_tl {--ignore-case ~ } ,
ignore-case .value_forbidden:n = true ,
reverse .code:n =\tl_put_right:Nn \l_tmpa_tl {--reverse ~ } ,
reverse .value_forbidden:n = true ,
exclude .code:n =\tl_put_right:Ne \l_tmpa_tl {
--exclude ~
\sys_if_shell_restricted:F'
\exp_not:n{#1}
\sys_if_shell_restricted:F'
~ } ,
exclude .value_required:n = true ,
type .choices:nn = {d,f}
{\tl_put_right:Nn \l_tmpa_tl {--type ~ #1 ~ }} ,
sort .choices:nn = {date,name}
{\tl_put_right:Nn \l_tmpa_tl {--sort ~ #1 ~ }} ,
pattern .code:n =\tl_put_right:Nn \l_tmpa_tl {--pattern ~ } ,
pattern .value_forbidden:n = true ,
}
\ExplSyntaxOff
\endinput
%%
%% End of file `l3sys-query.sty'.
|