summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--urpm/args.pm6
-rwxr-xr-xurpmf19
2 files changed, 17 insertions, 8 deletions
diff --git a/urpm/args.pm b/urpm/args.pm
index 81bb3dbc..8c7cd4ea 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -166,6 +166,11 @@ my %options_spec = (
conffiles => add_param_closure('conf_files'),
debug => \$::debug,
literal => \$::literal,
+ name => sub {
+ add_param_closure('name')->();
+ #- Remove default tag in front if --name is explicitly given
+ $::qf =~ s/^%default:?//;
+ },
qf => \$::qf,
'uniq|u' => \$::uniq,
'verbose|v' => \$::verbose,
@@ -334,7 +339,6 @@ foreach my $k (qw(
filename
files
group
- name
obsoletes
packager
provides
diff --git a/urpmf b/urpmf
index b0f16802..91a0f555 100755
--- a/urpmf
+++ b/urpmf
@@ -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};
}
}