diff options
author | Norbert Preining <preining@logic.at> | 2009-08-27 12:59:09 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2009-08-27 12:59:09 +0000 |
commit | d2575925b6d7f9489ddb63a459443f44132978f3 (patch) | |
tree | c3db903f51fdb1f6290ce3c4db052198ce3d39f0 | |
parent | 5d7019ef59df604daed9b4f2ddafbfbbf39a1f86 (diff) |
machine readable output for tlmgr option
git-svn-id: svn://tug.org/texlive/trunk@14890 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 7f462fd5034..d2c33ce2f57 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -257,7 +257,8 @@ sub main { # --machine-readable is only supported by update. # - if ($::machinereadable && $action ne "update" && $action ne "install") { + if ($::machinereadable && + $action ne "update" && $action ne "install" && $action ne "option") { tlwarn("tlmgr: --machine-readable output not supported for $action\n"); } @@ -2417,8 +2418,12 @@ sub action_option { next if ($o =~ m/^sys_/); } if (defined $TLPDBOptions{$o}) { - info("$TLPDBOptions{$o}->[3] ($TLPDBOptions{$o}->[2]): " . - $localtlpdb->option($o) . "\n"); + if ($::machinereadable) { + print "$TLPDBOptions{$o}->[2]\t", $localtlpdb->option($o), "\n"; + } else { + info("$TLPDBOptions{$o}->[3] ($TLPDBOptions{$o}->[2]): " . + $localtlpdb->option($o) . "\n"); + } } else { tlwarn ("option $o not supported\n"); } @@ -2426,8 +2431,13 @@ sub action_option { } elsif ($what =~ m/^showall$/i) { my %loc = %{$localtlpdb->options}; for my $o (keys %TLPDBOptions) { - info("$TLPDBOptions{$o}->[3] ($TLPDBOptions{$o}->[2]): " . - (defined($loc{$o}) ? $loc{$o} : "(not set)") . "\n"); + if ($::machinereadable) { + print "$TLPDBOptions{$o}->[2]\t", + (defined($loc{$o}) ? $loc{$o} : "(not set)"), "\n"; + } else { + info("$TLPDBOptions{$o}->[3] ($TLPDBOptions{$o}->[2]): " . + (defined($loc{$o}) ? $loc{$o} : "(not set)") . "\n"); + } } } else { if ($what eq "location") { @@ -2538,8 +2548,12 @@ sub action_option { } } else { # show current value - info ("$TLPDBOptions{$opt}->[3] ($TLPDBOptions{$opt}->[2]): " . - $localtlpdb->option($opt) . "\n"); + if ($::machinereadable) { + print "$TLPDBOptions{$opt}->[2]\t", $localtlpdb->option($opt), "\n"; + } else { + info ("$TLPDBOptions{$opt}->[3] ($TLPDBOptions{$opt}->[2]): " . + $localtlpdb->option($opt) . "\n"); + } } last; } @@ -4684,8 +4698,12 @@ written to stdout). The idea is that a program can get all the information it needs by reading stdout. Currently this option only applies to the -L<update|/"update [I<option>]... [I<pkg>]..."> and -L<install|"install [I<option>]... I<pkg>..."> actions. +L<update|/"update [I<option>]... [I<pkg>]...">, the +L<install|"install [I<option>]... I<pkg>...">, and the +L<option|"option"> actions. + +=head2 update and install actions + The output format is as follows: fieldname "\t" value @@ -4805,6 +4823,14 @@ The estimated total time. =back +=head2 option action: + +The output format is as follows: + + key "\t" value + +If a value is not saved in the database the string C<(not set)> is shown. + If you are developing a program that uses this output, and find that changes would be helpful, do not hesitate to write the mailing list. |