summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2017-11-13 17:05:14 +0000
committerNorbert Preining <preining@logic.at>2017-11-13 17:05:14 +0000
commit3b7fca8248b6f2f73cb9d1dd6011c29fbc3b9f55 (patch)
tree95fbc2229db732cc2c41534fec180c347b4840b6 /Master/texmf-dist/scripts
parent86830c3b1728a5ad4d946bc32b722762a9010439 (diff)
tlmgr paper --json output
git-svn-id: svn://tug.org/texlive/trunk@45776 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rwxr-xr-xMaster/texmf-dist/scripts/texlive/tlmgr.pl19
1 files changed, 19 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl
index d925cc0f3cf..5cfe48fe220 100755
--- a/Master/texmf-dist/scripts/texlive/tlmgr.pl
+++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl
@@ -1213,6 +1213,19 @@ sub action_paper {
} elsif (!defined($newpaper)) { # tlmgr paper => show all current sizes.
my $ret = $F_OK;
+ if ($opts{'json'}) {
+ my @foo;
+ for my $prog (keys %TeXLive::TLPaper::paper) {
+ my $pkg = $TeXLive::TLPaper::paper{$prog}{'pkg'};
+ if ($localtlpdb->get_package($pkg)) {
+ my $val = TeXLive::TLPaper::do_paper($prog,$texmfconfig,"--json");
+ push @foo, $val;
+ }
+ }
+ my $json = TeXLive::TLUtils::encode_json(\@foo);
+ print "$json\n";
+ return $ret;
+ }
for my $prog (sort keys %TeXLive::TLPaper::paper) {
my $pkg = $TeXLive::TLPaper::paper{$prog}{'pkg'};
if ($localtlpdb->get_package($pkg)) {
@@ -7922,6 +7935,8 @@ default.
=item B<S<[xdvi|pdftex|dvips|dvipdfmx|context|psutils] paper [I<papersize>|--list]>>
+=item B<paper --json>
+
=back
With no arguments (C<tlmgr paper>), shows the default paper size setting
@@ -7942,6 +7957,10 @@ With a program given as the first argument and C<--list> given as the
last argument (e.g., C<tlmgr dvips paper --list>), shows all valid paper
sizes for that program. The first size shown is the default.
+If no argument is given but C<--json> is specified, the current status is
+outputed in JSON. For the format of JSON output see C<tlpkg/doc/JSON-formats.txt>,
+format definition C<TLPAPER>.
+
Incidentally, this syntax of having a specific program name before the
C<paper> keyword is unusual. It is inherited from the longstanding
C<texconfig> script, which supports other configuration settings for