From 3b7fca8248b6f2f73cb9d1dd6011c29fbc3b9f55 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 13 Nov 2017 17:05:14 +0000 Subject: tlmgr paper --json output git-svn-id: svn://tug.org/texlive/trunk@45776 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/scripts/texlive/tlmgr.pl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'Master/texmf-dist') 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|--list]>> +=item B + =back With no arguments (C), 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), 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, +format definition C. + Incidentally, this syntax of having a specific program name before the C keyword is unusual. It is inherited from the longstanding C script, which supports other configuration settings for -- cgit v1.2.3