+ my $orgopt = $_;
+
+ my $not_a_nailing_opt = sub { # usage 1
+ unshift @ARGV, $orgopt;
+ unshift @ARGV, 'cargo';
+ $is_cargo = 1;
+ no warnings qw(exiting);
+ last;
+ };
+ $not_a_nailing_opt->() unless m{^-};
+ $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[0] eq '--') { # usage 3
+ shift;
+ $is_cargo = 0;
+ } elsif (grep { $_ eq '--' } @ARGV) { # usage 2
+ $is_cargo = 1;
+ } elsif ($ARGV[0] =~ m{[^/]*cargo[^/]*$}) { # usage 2
+ $is_cargo = 1;
+ } else { # usage 3
+ $is_cargo = 0;
+ }
+ last;
+ }