From 7f79f78d1a0af648a116cd1e39a073e051502b9c Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Mon, 19 Apr 2004 12:10:00 +0000 Subject: Some more options refactorisation. The --from option of urpmi.addmedia was being ignored; fix it. --- urpm/args.pm | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) (limited to 'urpm') 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 -- cgit v1.2.1