Debian Codegraph @

texmf-dist/tex/latex-dev/tools/l3sys-query.sty

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