Kaynağa Gözat

dpkg-buildflags: Fold list action handling with the other actions if block

Guillem Jover 11 yıl önce
ebeveyn
işleme
6775adf4af
1 değiştirilmiş dosya ile 5 ekleme ve 4 silme
  1. 5 4
      scripts/dpkg-buildflags.pl

+ 5 - 4
scripts/dpkg-buildflags.pl

@@ -62,6 +62,7 @@ sub usage {
 }
 }
 
 
 my ($param, $action);
 my ($param, $action);
+my $load_config = 1;
 
 
 while (@ARGV) {
 while (@ARGV) {
     $_ = shift(@ARGV);
     $_ = shift(@ARGV);
@@ -82,6 +83,7 @@ while (@ARGV) {
         usageerr(_g('two commands specified: --%s and --%s'), $1, $action)
         usageerr(_g('two commands specified: --%s and --%s'), $1, $action)
             if defined($action);
             if defined($action);
         $action = $1;
         $action = $1;
+        $load_config = 0 if $action eq 'list';
     } elsif (m/^-(?:\?|-help)$/) {
     } elsif (m/^-(?:\?|-help)$/) {
         usage();
         usage();
         exit 0;
         exit 0;
@@ -97,16 +99,15 @@ $action //= 'dump';
 
 
 my $build_flags = Dpkg::BuildFlags->new();
 my $build_flags = Dpkg::BuildFlags->new();
 
 
+$build_flags->load_config() if $load_config;
+
 if ($action eq 'list') {
 if ($action eq 'list') {
     foreach my $flag ($build_flags->list()) {
     foreach my $flag ($build_flags->list()) {
 	print "$flag\n";
 	print "$flag\n";
     }
     }
     exit(0);
     exit(0);
-}
-
-$build_flags->load_config();
+} elsif ($action eq 'get') {
 
 
-if ($action eq 'get') {
     if ($build_flags->has($param)) {
     if ($build_flags->has($param)) {
 	print $build_flags->get($param) . "\n";
 	print $build_flags->get($param) . "\n";
 	exit(0);
 	exit(0);