summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-01-18 14:34:17 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-01-18 14:34:17 +0000
commit0e244b48293b1ce13ac45b38a7c4632194eb431c (patch)
treecbba05327540fd80e76415a9dfb81853136100b3
parent57a4d47a7977a076a80602bdfa85a64c163f0502 (diff)
downloadurpmi-0e244b48293b1ce13ac45b38a7c4632194eb431c.tar
urpmi-0e244b48293b1ce13ac45b38a7c4632194eb431c.tar.gz
urpmi-0e244b48293b1ce13ac45b38a7c4632194eb431c.tar.bz2
urpmi-0e244b48293b1ce13ac45b38a7c4632194eb431c.tar.xz
urpmi-0e244b48293b1ce13ac45b38a7c4632194eb431c.zip
factorize duplicated code
-rw-r--r--urpm/args.pm30
1 files changed, 15 insertions, 15 deletions
diff --git a/urpm/args.pm b/urpm/args.pm
index 14cfe887..de7c6a58 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -210,14 +210,7 @@ my %options_spec = (
}
else {
# This is for non-option arguments.
- if ($::literal) {
- $p = quotemeta $p;
- } else {
- push @::raw_non_literals, $p;
- # quote "+" chars for packages with + in their names
- $p =~ s/\+/\\+/g;
- }
- $::expr .= "m{$p}" . $::pattern;
+ add_urpmf_parameter($p);
}
},
},
@@ -348,6 +341,19 @@ sub add_urpmf_cmdline_tags {
}
}
+sub add_urpmf_parameter {
+ my ($p) = @_;
+
+ if ($::literal) {
+ $p = quotemeta $p;
+ } else {
+ push @::raw_non_literals, $p;
+ # quote "+" chars for packages with + in their names
+ $p =~ s/\+/\\+/g;
+ }
+ $::expr .= "m{$p}" . $::pattern;
+}
+
# common options setup
foreach my $k ("help|h", "version", "no-locales", "test!", "force", "root=s", "use-distrib=s",
@@ -435,13 +441,7 @@ sub parse_cmdline {
}
if ($tool eq 'urpmf' && @ARGV && $ARGV[0] eq '--') {
if (@ARGV == 2) {
- my $p = $ARGV[1];
- if ($::literal) {
- $p = quotemeta $p;
- } else {
- $p =~ s/\+/\\+/g;
- }
- $::expr .= "m{$p}" . $::pattern;
+ add_urpmf_parameter($ARGV[1]);
$ret = 1;
}
else {