# This file belongs to TLPM v2.16, TeX Live Package Manager # Public Domain, P.Jackowski@gust.org.pl # list [-pfe] # display a list of packages matching sub list { my ($arg,$reg,$mask); my $pkges = $source_pkges; local $tl_target_new; local $list_method = \&list_packages; local $reg_method = \&string2reg; local $read_method = \&read_source; while(defined($arg = shift)) { $arg eq '' and next or &no_opt($arg) and $mask = $arg or &is_opt($arg,'f','files') and $list_method = \&list_files or &is_opt($arg,'p','packages') and $list_method = \&list_packages or &is_opt($arg,'e','expression') and $reg_method = \&string2preg or &is_opt($arg,'d','directory') and $read_method = \&read_target and $pkges = $target_pkges and do {$tl_target_new = shift;1} or &is_opt($arg,'h','help') and return $heeelp -> ('list') or &rem_opt($arg) and return $error{'wrong_opt'} -> ($arg,'list --help'); } eval '$reg = $reg_method -> ($mask)'; if($@){return $error{'wrong_reg'} -> ($mask)} return if $read_method -> (); return $list_method -> ($reg,$pkges); } sub list_packages { my ($reg,$pkges) = @_; my $count = 0; $mess -> (grep {/$reg/ and ++$count} &get_pkg_all($pkges)); $mess -> ("\n"); if($tlpm_redir < 2) { $message -> (&one_or_more($count,'matching package','matching packages')); } } sub list_files { my ($reg,$pkges) = @_; my $count = 0; $mess -> (grep {/$reg/ and ++$count} &get_file_all($pkges)); $mess -> ("\n"); if($tlpm_redir < 2) { $message -> (&one_or_more($count,'matching file','matching files')); } } 1;