diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-10-18 17:14:46 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-10-18 17:14:46 +0000 |
commit | a2bca43a4fa62b06b4dbaee88c495a5d6ff5245c (patch) | |
tree | 6d118624c9df8b8fb626710c847657f6a75d1e44 /urpmf | |
parent | 8ad21ded96d7c7ebe33a33aae621bf891d1170a7 (diff) | |
download | urpmi-a2bca43a4fa62b06b4dbaee88c495a5d6ff5245c.tar urpmi-a2bca43a4fa62b06b4dbaee88c495a5d6ff5245c.tar.gz urpmi-a2bca43a4fa62b06b4dbaee88c495a5d6ff5245c.tar.bz2 urpmi-a2bca43a4fa62b06b4dbaee88c495a5d6ff5245c.tar.xz urpmi-a2bca43a4fa62b06b4dbaee88c495a5d6ff5245c.zip |
Implement a nicer default behaviour for --name
Diffstat (limited to 'urpmf')
-rwxr-xr-x | urpmf | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -82,7 +82,7 @@ our $full = ''; # -f : print rpm fullname instead of rpm name our $literal = 0; # should we quotemeta the pattern our $media = ''; our $pattern = ''; # regexp match flags ("i" or "") -our $qf = '%name'; # default format +our $qf = '%default'; # format string our $sortmedia = ''; our $synthesis = ''; our $uniq = ''; @@ -96,17 +96,22 @@ our %uniq; #- parse arguments list. urpm::args::parse_cmdline(); -if ($full) { $qf =~ s/%name\b/%fullname/ } -my $urpm = new urpm; -$verbose or $urpm->{log} = sub {}; - -if ($qf eq '%name') { +if ($qf eq '%default') { #- nothing on the command-line : default is to search on file names $qf = '%name:%files'; $params{files} = 1; +} else { + #- else default to a leading %name + $qf =~ s/%default\b/%name/; } +#- replace first %name by %fullname if -f was specified +if ($full) { $qf =~ s/%name\b/%fullname/ } + +my $urpm = new urpm; +$verbose or $urpm->{log} = sub {}; + #- build the callback matching the expression. #- XXX it would be nice to use "my $_" in this callback. my $callback = qq<sub { @@ -185,6 +190,6 @@ if ($use_hdlist) { } @{ $urpm->{media} }; if (!@hdmedia) { print N("Note: since no media searched uses hdlists, urpmf was unable to return any result\n"); - print N("You may want to use --name to search for package names.\n") if !$params{filename}; + print N("You may want to use --name to search for package names.\n") if !$params{name}; } } |