diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-01-18 14:34:17 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-01-18 14:34:17 +0000 |
commit | 0e244b48293b1ce13ac45b38a7c4632194eb431c (patch) | |
tree | cbba05327540fd80e76415a9dfb81853136100b3 /urpm | |
parent | 57a4d47a7977a076a80602bdfa85a64c163f0502 (diff) | |
download | urpmi-0e244b48293b1ce13ac45b38a7c4632194eb431c.tar urpmi-0e244b48293b1ce13ac45b38a7c4632194eb431c.tar.gz urpmi-0e244b48293b1ce13ac45b38a7c4632194eb431c.tar.bz2 urpmi-0e244b48293b1ce13ac45b38a7c4632194eb431c.tar.xz urpmi-0e244b48293b1ce13ac45b38a7c4632194eb431c.zip |
factorize duplicated code
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/args.pm | 30 |
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 { |