diff options
Diffstat (limited to 'Master/setuptl/TLPM/incl.pm')
-rw-r--r-- | Master/setuptl/TLPM/incl.pm | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/Master/setuptl/TLPM/incl.pm b/Master/setuptl/TLPM/incl.pm new file mode 100644 index 00000000000..a86c20eab39 --- /dev/null +++ b/Master/setuptl/TLPM/incl.pm @@ -0,0 +1,60 @@ +# This file belongs to TLPM v2.14, TeX Live Package Manager +# Public Domain, P.Jackowski@gust.org.pl + +# incl <pkg> [-pfer] <mask> +# display a list of included packages matching <mask> + +sub incl +{ + local $reg_method = \&string2reg; + local $incl_method = \&incl_packages; + local $getp_method = \&get_pkg_requires_all; + local $getf_method = \&get_pkg_contains_all; + my $pkges = $source_pkges; + my ($pkg,$arg,$reg); + while(defined($arg = shift)) + { + $arg eq '' and next + or &no_opt($arg) and (defined $pkg ? $reg = $arg : $pkg = $arg) + or &is_opt($arg,'f','files') and $incl_method = \&incl_files + or &is_opt($arg,'p','packages') and $incl_method = \&incl_packages + or &is_opt($arg,'e','expression') and $reg_method = \&string2preg + or &is_opt($arg,'j','justone') and $getp_method = \&get_pkg_requires + and $getf_method = \&get_pkg_contains + or &is_opt($arg,'r','recurse') and $getp_method = \&get_pkg_requires_all + and $getf_method = \&get_pkg_contains_all + or &is_opt($arg,'h','help') and return $heeelp -> ('incl') + or &rem_opt($arg) and return $error{'wrong_opt'} -> ($arg,'incl --help'); + } + return $error{'pkg_unspec'} -> () if $pkg eq ''; + eval '$reg = $reg_method -> ($reg)'; + if($@){return $error{'wrong_reg'} -> ($reg)} + return if &read_source(); + is_pkg($pkg,$pkges) or return $error{'pkg_not_found'} -> ($pkg); + $incl_method -> ($pkg,$reg,$pkges); +} + +sub incl_packages +{ + my ($pkg,$reg,$pkges) = @_; + my $count = 0; + $mess -> (grep {/$reg/ and ++$count} $getp_method -> ($pkg,$pkges)); + $mess -> ("\n"); + if($tlpm_redir < 2) + { + $message -> (&one_or_more($count,'package','packages')); + } +} + +sub incl_files +{ + my ($pkg,$reg,$pkges) = @_; + my $count = 0; + $mess -> (grep {/$reg/ and ++$count} $getf_method -> ($pkg,$pkges));$mess -> ("\n"); + if($tlpm_redir < 2) + { + $message -> ("$count " . ($count == 1 ? "file" : "files")); + } +} + +1; |