1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00

When ‘--help’ is given, just run ‘man’ to show the manual page

I.e. do what git does.  I'm too lazy to keep the builtin help text up
to date :-)

Also add ‘--help’ to various commands that lacked it
(e.g. nix-collect-garbage).
This commit is contained in:
Eelco Dolstra 2012-10-03 16:37:06 -04:00
parent 9c41c66c5b
commit a562d544d8
25 changed files with 51 additions and 329 deletions

View file

@ -24,22 +24,11 @@ my $writeManifest = 0;
my $archivesURL;
my @roots;
sub showSyntax {
print STDERR <<EOF
Usage: nix-push --dest DIR [--manifest] [--url-prefix URL] PATHS...
`nix-push' packs the closure of PATHS into a set of NAR files stored
in DIR. Optionally generate a manifest.
EOF
; # `
exit 1;
}
for (my $n = 0; $n < scalar @ARGV; $n++) {
my $arg = $ARGV[$n];
if ($arg eq "--help") {
showSyntax;
exec "man nix-push" or die;
} elsif ($arg eq "--bzip2") {
$compressionType = "bzip2";
} elsif ($arg eq "--force") {
@ -56,13 +45,13 @@ for (my $n = 0; $n < scalar @ARGV; $n++) {
die "$0: `$arg' requires an argument\n" unless $n < scalar @ARGV;
$archivesURL = $ARGV[$n];
} elsif (substr($arg, 0, 1) eq "-") {
showSyntax;
die "$0: unknown flag `$arg'\n";
} else {
push @roots, $arg;
}
}
showSyntax if !defined $destDir;
die "$0: please specify a destination directory\n" if !defined $destDir;
$archivesURL = "file://$destDir" unless defined $archivesURL;