chiark / gitweb /
nailing-cargo: Tolerate lack of build commands with -n
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Jul 2020 17:49:57 +0000 (18:49 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 25 Jul 2020 17:49:57 +0000 (18:49 +0100)
We just use dummy values instead.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
nailing-cargo

index 98436be5a58b745dfe2b75a85311cf246e16ae46..370fa05c5e7cbb586032045abb97a7c2b64da461 100755 (executable)
@@ -845,7 +845,10 @@ sub parse_args () {
   #    $is_cargo==0   <build-command>...
 
  OPTS: for (;;) {
-    @ARGV or die "$self: need cargo subcommand\n";
+    if (!@ARGV) {
+      die "$self: need cargo subcommand\n" unless $noact;
+      push @ARGV, "CARGO-SUBCOMMAND"; # dummy, user may see it
+    }
 
     $_ = shift @ARGV;
     my $orgopt = $_;
@@ -861,7 +864,10 @@ sub parse_args () {
     $not_a_nailing_opt->() if $_ eq '--';
 
     if ($_ eq '---') { # usage 2 or 3
-      die "$self: --- must be followed by build command\n" unless @ARGV;
+      if (!@ARGV) {
+       die "$self: --- must be followed by build command\n" unless $noact;
+       push @ARGV, 'BUILD-COMMAND';
+      }
       if ($ARGV[0] eq '--') { # usage 3
        shift;
        $is_cargo = 0;