From a8aab6a5879b5e2b6f0668647d1e90bdbff98cdb Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 14 Nov 2017 01:55:52 +0000 Subject: TLPDB: factorize json code, tlmgr: json for option git-svn-id: svn://tug.org/texlive/trunk@45791 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/scripts/texlive/tlmgr.pl | 20 +++++++++++++++-- Master/tlpkg/TeXLive/TLPDB.pm | 35 ++++++++++++++++++++++-------- Master/tlpkg/doc/JSON-formats.txt | 28 ++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 11 deletions(-) diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index d49075b42e6..75fe0a2e5f2 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -4392,7 +4392,13 @@ sub action_option { $what = "show" unless defined($what); init_local_db(); my $ret = $F_OK; + my %json; if ($what =~ m/^show$/i) { + if ($opts{'json'}) { + my $json = $localtlpdb->options_as_json(); + print("$json\n"); + return($ret); + } for my $o (sort keys %{$localtlpdb->options}) { # ignore some things which are w32 specific next if ($o eq "desktop_integration" && !win32()); @@ -4414,6 +4420,11 @@ sub action_option { } } } elsif ($what =~ m/^showall$/i) { + if ($opts{'json'}) { + my $json = $localtlpdb->options_as_json(); + print("$json\n"); + return($ret); + } my %loc = %{$localtlpdb->options}; for my $o (sort keys %TLPDBOptions) { if ($::machinereadable) { @@ -7833,9 +7844,9 @@ from the local keyring. =over 4 -=item B