diff options
author | Norbert Preining <preining@logic.at> | 2017-10-13 06:50:59 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2017-10-13 06:50:59 +0000 |
commit | 8b02c12ef1888a8819a0e33ba7449a522a87afba (patch) | |
tree | ab89d27f2388db37df6c125ceb678802a3dcccf1 /Master/texmf-dist | |
parent | bea24bc71979f672b3580e56cefc931ebf964906 (diff) |
tlmgr dump-tlpdb -json possible
git-svn-id: svn://tug.org/texlive/trunk@45532 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rwxr-xr-x | Master/texmf-dist/scripts/texlive/tlmgr.pl | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl index eb0ed19d3e9..febca48d334 100755 --- a/Master/texmf-dist/scripts/texlive/tlmgr.pl +++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl @@ -169,7 +169,7 @@ my %action_specification = ( "function" => \&action_conf }, "dump-tlpdb" => { - "options" => { "local" => 1, remote => 1 }, + "options" => { local => 1, remote => 1, json => 1 }, "run-post" => 0, "function" => \&action_dumptlpdb }, @@ -1378,14 +1378,22 @@ sub action_dumptlpdb { $::machinereadable = 1; if ($opts{"local"} && !$opts{"remote"}) { - # for consistency we write out the location of the installation, - # too, in the same format as when dumping the remote tlpdb - print "location-url\t", $localtlpdb->root, "\n"; - $localtlpdb->writeout; + if ($opts{"json"}) { + print $localtlpdb->as_json; + } else { + # for consistency we write out the location of the installation, + # too, in the same format as when dumping the remote tlpdb + print "location-url\t", $localtlpdb->root, "\n"; + $localtlpdb->writeout; + } } elsif ($opts{"remote"} && !$opts{"local"}) { - init_tlmedia_or_die(); - $remotetlpdb->writeout; + init_tlmedia_or_die(1); + if ($opts{"json"}) { + print $remotetlpdb->as_json; + } else { + $remotetlpdb->writeout; + } } else { tlwarn("$prg dump-tlpdb: need exactly one of --local and --remote.\n"); |