That change breaks fink list. Now you will always get the help screen. Doesn�t metter whitch option added.
Am 21.08.2004 um 22:14 schrieb Daniel Macks:
Update of /cvsroot/fink/fink/perlmod/Fink In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26529
Modified Files: ChangeLog Engine.pm Log Message: Extract list/apropos help into separate function. Pass $cmd through fetch-* to make help cmd-specific.
Index: Engine.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Engine.pm,v
retrieving revision 1.195
retrieving revision 1.196
diff -u -d -r1.195 -r1.196
--- Engine.pm 20 Aug 2004 05:19:19 -0000 1.195
+++ Engine.pm 21 Aug 2004 22:14:42 -0000 1.196
@@ -250,7 +250,7 @@
(
"installedstate" => 0
);
- my ($width, $namelen, $verlen, $dotab, $wanthelp);
+ my ($width, $namelen, $verlen, $dotab);
my $cmd = shift;
use Getopt::Long;
$formatstr = "%s %-15.15s %-11.11s %s\n";
@@ -261,7 +261,7 @@
if ($cmd eq "list") {
GetOptions(
'width|w=s' => \$width,
- 'tab|t' => \$dotab,
+ 'tab|t' => \$dotab,
'installed|i' => sub {$options{installedstate} |=3;},
'uptodate|u' => sub {$options{installedstate} |=2;},
'outdated|o' => sub {$options{installedstate} |=1;},
@@ -270,62 +270,15 @@
'section|s=s' => \$section,
'maintainer|m=s' => \$maintainer,
'tree|r=s' => \$pkgtree,
- 'help|h' => \$wanthelp
+ 'help|h' => \&help_list_apropos($cmd)
) or die "fink list: unknown option\nType 'fink list --help' for more information.\n";
} else { # apropos
GetOptions(
'width|w=s' => \$width,
'tab|t' => \$dotab,
- 'help|h' => \$wanthelp
+ 'help|h' => \&help_list_apropos($cmd)
) or die "fink list: unknown option\nType 'fink apropos --help' for more information.\n";
}
- if ($wanthelp) {
- require Fink::FinkVersion;
- my $version = Fink::FinkVersion::fink_version();
-
- if ($cmd eq "list") {
- print <<"EOF";
-Fink $version
-
-Usage: fink list [options] [string]
-
-Options:
- -w xyz, --width=xyz - Sets the width of the display you would like the output
- formatted for. xyz is either a numeric value or auto.
- auto will set the width based on the terminal width.
- -t, --tab - Outputs the list with tabs as field delimiter.
- -i, --installed - Only list packages which are currently installed.
- -u, --uptodate - Only list packages which are up to date.
- -o, --outdated - Only list packages for which a newer version is
- available.
- -n, --notinstalled - Only list packages which are not installed.
- -b, --buildonly - Only list packages which are Build Only Depends
- -s expr, - Only list packages in the section(s) matching expr
- --section=expr (example: fink list --section=x11).
- -m expr, - Only list packages with the maintainer(s) matching expr
- --maintainer=expr (example: fink list --maintainer=beren12).
- -r expr, - Only list packages with the tree matching expr
- --tree=expr (example: fink list --tree=stable).
- -h, --help - This help text.
-
-EOF
- } else { # apropos
- print <<"EOF";
-Fink $version
-
-Usage: fink apropos [options] [string]
-
-Options:
- -w xyz, --width=xyz - Sets the width of the display you would like the output
- formatted for. xyz is either a numeric value or auto.
- auto will set the width based on the terminal width.
- -t, --tab - Outputs the list with tabs as field delimiter.
- -h, --help - This help text.
-
-EOF
- }
- exit 0;
- }
if ($options{installedstate} == 0) {$options{installedstate} = 7;}
# By default or if --width=auto, compute the output width to fit exactly into the terminal
@@ -434,6 +387,55 @@
}
}
+sub help_list_apropos {
+ my $cmd = shift;
+ require Fink::FinkVersion;
+ my $version = Fink::FinkVersion::fink_version();
+
+ if ($cmd eq "list") {
+ print <<"EOF";
+Fink $version
+
+Usage: fink list [options] [string]
+
+Options:
+ -w xyz, --width=xyz - Sets the width of the display you would like the output
+ formatted for. xyz is either a numeric value or auto.
+ auto will set the width based on the terminal width.
+ -t, --tab - Outputs the list with tabs as field delimiter.
+ -i, --installed - Only list packages which are currently installed.
+ -u, --uptodate - Only list packages which are up to date.
+ -o, --outdated - Only list packages for which a newer version is
+ available.
+ -n, --notinstalled - Only list packages which are not installed.
+ -b, --buildonly - Only list packages which are Build Only Depends
+ -s expr, - Only list packages in the section(s) matching expr
+ --section=expr (example: fink list --section=x11).
+ -m expr, - Only list packages with the maintainer(s) matching expr
+ --maintainer=expr (example: fink list --maintainer=beren12).
+ -r expr, - Only list packages with the tree matching expr
+ --tree=expr (example: fink list --tree=stable).
+ -h, --help - This help text.
+
+EOF
+ } else { # apropos
+ print <<"EOF";
+Fink $version
+
+Usage: fink apropos [options] [string]
+
+Options:
+ -w xyz, --width=xyz - Sets the width of the display you would like the output
+ formatted for. xyz is either a numeric value or auto.
+ auto will set the width based on the terminal width.
+ -t, --tab - Outputs the list with tabs as field delimiter.
+ -h, --help - This help text.
+
+EOF
+ }
+ exit 0;
+}
+
sub cmd_listpackages {
my ($pname, $package);
@@ -555,29 +557,29 @@ }
sub parse_fetch_options {
+ my $cmd = shift;
my %options =
(
"norestrictive" => 0,
"dryrun" => 0,
"wanthelp" => 0,
);
-
+
my @temp_ARGV = @ARGV;
@[EMAIL PROTECTED];
Getopt::Long::Configure(qw(bundling ignore_case require_order no_getopt_compat prefix_pattern=(--|-)));
GetOptions('ignore-restrictive|i' => sub {$options{norestrictive} = 1 } ,
'dry-run|d' => sub {$options{dryrun} = 1 } ,
'help|h' => sub {$options{wanthelp} = 1 })
- or die "fink fetch: unknown option\nType 'fink fetch-missing --help' or 'fetch-all --help' for more information.\n";
-
+ or die "fink fetch: unknown option\nType 'fink $cmd --help' for more information.\n";
if ($options{wanthelp} == 1) {
require Fink::FinkVersion;
my $finkversion = Fink::FinkVersion::fink_version();
print <<"EOF";
Fink $finkversion
-Usage: fink fetch-{missing,all} [options]
-
+Usage: fink $cmd [options]
+
Options:
-i, --ignore-restrictive - Do not fetch sources for packages with
a "Restrictive" license. Useful for mirroring.
@@ -585,7 +587,7 @@
-h, --help - This help text.
EOF - die " "; + exit 0; } @_ = @ARGV; @ARGV = @temp_ARGV; @@ -610,7 +612,7 @@ my ($pname, $package, $version, $vo); my (%options, $norestrictive, $dryrun); - %options = &parse_fetch_options(@_); + %options = &parse_fetch_options("fetch-all", @_); $norestrictive = $options{"norestrictive"} || 0; $dryrun = $options{"dryrun"} || 0; @@ -637,7 +639,7 @@ my ($pname, $package, $version, $vo); my (%options, $norestrictive, $dryrun);
- %options = &parse_fetch_options(@_); + %options = &parse_fetch_options("fetch-missing", @_); $norestrictive = $options{"norestrictive"} || 0; $dryrun = $options{"dryrun"} || 0;
Index: ChangeLog =================================================================== RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v retrieving revision 1.697 retrieving revision 1.698 diff -u -d -r1.697 -r1.698 --- ChangeLog 20 Aug 2004 05:19:19 -0000 1.697 +++ ChangeLog 21 Aug 2004 22:14:42 -0000 1.698 @@ -1,3 +1,8 @@ +2004-08-21 Daniel Macks <[EMAIL PROTECTED]> + + * Engine.pm: Extract list/apropos help into separate function. + Pass $cmd through fetch-* to make help cmd-specific. + 2004-08-20 Daniel Macks <[EMAIL PROTECTED]>
* Engine.pm: sync helpscreen and Getopt flag names.
------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ Fink-commits mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-commits
------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ Fink-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/fink-devel
