From bed89b8bed7c9b53f94b98e6bdc9e7efbbc3e466 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 17 Jan 2009 02:01:27 +0000 Subject: (action_paper): make tlmgr paper show all current defaults; try to make documentation clearer. git-svn-id: svn://tug.org/texlive/trunk@11901 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf/scripts/texlive/tlmgr2.pl | 60 +++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/Master/texmf/scripts/texlive/tlmgr2.pl b/Master/texmf/scripts/texlive/tlmgr2.pl index 02266898dfa..2f1759ef9e2 100755 --- a/Master/texmf/scripts/texlive/tlmgr2.pl +++ b/Master/texmf/scripts/texlive/tlmgr2.pl @@ -707,10 +707,10 @@ sub action_remove { # ARGV can look like: # paper a4 # paper letter -# [xdvi|dvips|pdftex|dvipdfm|dvipdfmx|context] paper [help|papersize|--list] +# [xdvi|...|context] paper [help|papersize|--list] # sub action_paper { - my %ret; + my %ret = (); action_gui("config") if $opts{"gui"}; tlwarn("machine-readable output not supported for paper\n") if $::machinereadble; @@ -720,15 +720,26 @@ sub action_paper { $ENV{"TEXMFCONFIG"} = $texmfsysconfig; my $action = shift @ARGV; - if ($action =~ m/^paper$/i) { + if ($action =~ m/^paper$/i) { # generic paper my $newpaper = shift @ARGV; - if (!defined($newpaper) || $newpaper !~ /^(a4|letter)$/) { - $newpaper = "the empty string." if !defined($newpaper); - tlwarn("tlmgr: paper expects `a4' or `letter', not $newpaper.\n"); - return; + if ($opts{"list"}) { # tlmgr paper --list => complain. + tlwarn("tlmgr: ignoring paper setting to $newpaper with --list\n") + if $newpaper; # complain if they tried to set, too. + tlwarn("tlmgr: please specify a program before paper --list, ", + "as in: tlmgr pdftex paper --list\n"); + + } elsif (!defined($newpaper)) { # tlmgr paper => show all current sizes. + TeXLive::TLPaper::paper_all($texmfsysconfig,undef); + + } elsif ($newpaper !~ /^(a4|letter)$/) { # tlmgr paper junk => complain. + $newpaper = "the empty string" if !defined($newpaper); + tlwarn("tlmgr: expected `a4' or `letter' after paper, not $newpaper\n"); + + } else { # tlmgr paper {a4|letter} => do it. + merge_into(\%ret,TeXLive::TLPaper::paper_all($texmfsysconfig,$newpaper)); } - merge_into(\%ret, TeXLive::TLPaper::paper_all($texmfsysconfig, $newpaper)); - } else { + + } else { # program-specific paper my $prog = $action; # first argument is the program to change my $arg = shift @ARGV; # get "paper" argument if (!defined($arg) || $arg ne "paper") { @@ -736,8 +747,8 @@ sub action_paper { tlwarn("tlmgr: expected `paper' after $prog, not $arg\n"); return; } - # the do_paper progs check for the arguments --list, so if given - # put it back on the cmd line + # the do_paper progs check for the argument --list, so if given + # restore it to the cmd line. unshift(@ARGV, "--list") if $opts{"list"}; merge_into(\%ret, TeXLive::TLPaper::do_paper($prog,$texmfsysconfig,@ARGV)); } @@ -3068,18 +3079,29 @@ directories specified by the respective options (see above). =over 4 -=item B +=item B -=item B - -=item B<[xdvi|pdftex|dvips|dvipdfmx|dvipdfm|context] paper [help|I|--list]> +=item B|--list]>> =back -Configures the system wide paper settings, either for all programs at -once (first two forms), or just for the specified program (third -form). The third form with C<--list> outputs all known papersizes for the -specified program. +With no arguments (C), shows the default paper size setting +for all known programs. + +With one argument (e.g., C), sets the default for all +known programs to that paper size. + +With a program given as the first argument and no paper size specified +(e.g., C), shows the default paper size for that +program. + +With a program given as the first argument and a paper size as the last +argument (e.g., C), set the default for that +program to that paper size. + +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. =head2 arch list|add I... -- cgit v1.2.3