summaryrefslogtreecommitdiffstats
path: root/urpm/args.pm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-04-19 12:10:00 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-04-19 12:10:00 +0000
commit7f79f78d1a0af648a116cd1e39a073e051502b9c (patch)
tree8ae051619b77ff62baad7c689d6eadb68401cbcc /urpm/args.pm
parentf2afab2525937a0a6e3028b78ea1763696ac7cee (diff)
downloadurpmi-7f79f78d1a0af648a116cd1e39a073e051502b9c.tar
urpmi-7f79f78d1a0af648a116cd1e39a073e051502b9c.tar.gz
urpmi-7f79f78d1a0af648a116cd1e39a073e051502b9c.tar.bz2
urpmi-7f79f78d1a0af648a116cd1e39a073e051502b9c.tar.xz
urpmi-7f79f78d1a0af648a116cd1e39a073e051502b9c.zip
Some more options refactorisation. The --from option of urpmi.addmedia
was being ignored; fix it.
Diffstat (limited to 'urpm/args.pm')
-rw-r--r--urpm/args.pm44
1 files changed, 27 insertions, 17 deletions
diff --git a/urpm/args.pm b/urpm/args.pm
index f9062727..36e84b79 100644
--- a/urpm/args.pm
+++ b/urpm/args.pm
@@ -21,6 +21,14 @@ my $urpm;
# stores the values of the command-line options
our %options;
+sub import {
+ if ($_[1] eq 'options') {
+ # export the %options hash
+ no strict 'refs';
+ *{caller().'::options'} = \%options;
+ }
+}
+
# options specifications for Getopt::Long
my %options_spec = (
@@ -218,30 +226,30 @@ my %options_spec = (
},
'urpmi.update' => {
- a => \$::options{all},
- c => sub { $::options{noclean} = 0 },
- f => sub { ++$::options{force} },
- z => sub { ++$::options{compress} },
- update => \$::options{update},
- 'force-key' => \$::options{forcekey},
- 'limit-rate=s' => \$::options{limit_rate},
- 'no-md5sum' => \$::options{nomd5sum},
+ a => \$options{all},
+ c => sub { $options{noclean} = 0 },
+ f => sub { ++$options{force} },
+ z => sub { ++$options{compress} },
+ update => \$options{update},
+ 'force-key' => \$options{forcekey},
+ 'limit-rate=s' => \$options{limit_rate},
+ 'no-md5sum' => \$options{nomd5sum},
'noa|d' => \my $dummy, # default, keeped for compatibility
'<>' => sub { push @::toupdates, $_[0] },
},
'urpmi.addmedia' => {
- 'probe-synthesis' => sub { $::options{probe_with} = 'synthesis' },
- 'probe-hdlist' => sub { $::options{probe_with} = 'hdlist' },
- 'no-probe' => sub { $::options{probe_with} = undef },
- distrib => sub { $::options{distrib} = undef },
- 'from=s' => \$::options{mirrors_url},
- 'version=s' => \$::options{version},
- 'arch=s' => \$::options{arch},
- virtual => \$::options{virtual},
+ 'probe-synthesis' => sub { $options{probe_with} = 'synthesis' },
+ 'probe-hdlist' => sub { $options{probe_with} = 'hdlist' },
+ 'no-probe' => sub { $options{probe_with} = undef },
+ distrib => sub { $options{distrib} = undef },
+ 'from=s' => \$options{mirrors_url},
+ 'version=s' => \$options{version},
+ 'arch=s' => \$options{arch},
+ virtual => \$options{virtual},
'<>' => sub {
if ($_[0] =~ /^--distrib-(.*)$/) {
- $::options{distrib} = $1;
+ $options{distrib} = $1;
}
else {
push @::cmdline, $_[0];
@@ -297,6 +305,8 @@ urpm::args - command-line argument parser for the urpm* tools
=head1 SYNOPSIS
+ urpm::args::parse_cmdline();
+
=head1 DESCRIPTION
=cut