* `!locked`: cargo would reject `--locked`, so don't pass it. Hazardous.
* `!offline`: the build command would reject `--offline`, so never pass it. *Not* overridden by configuration or command line.
+ * `-h` | `--help`: Print usage summary.
+
Environment of the build command
--------------------------------
#!/usr/bin/perl -w
# nailing-cargo: wrapper to use unpublished local crates
# SPDX-License-Identifier: AGPL-3.0-or-later
+our $usage = <<'END';
+
+usages:
+
+ nailing-cargo <nailing-opts> <cargo-opts> [--] <subcmd>...
+ nailing-cargo <nailing-opts> --- <cargo> <cargo-opts> [--] <subcmd>...
+ nailing-cargo <nailing-opts> --- [--] <build-command>...
+
+options:
+
+ -v Increase verbosity. (Default is 1)
+ -q Set verbosity to 0
+ -D Increase amount of debugging dump.
+ -n "No action": stop after writing Cargo.toml.nailing~
+ everywhere, and do not run any build command
+
+ -c Do add cargo command line options } default is add if
+ -C Do not add cargo command line options } command is cargo
+
+ -o --online -O --offline
+ -u --cargo-lock-update -U --no-cargo-lock-update
+
+ -T<arch> --target=<arch> Specify target architecture
+ -h --help Print this message
+
+ -s<subcommand> Treat command as `cargo <subcommand>`
+ --subcommand-props=<prop>,... Override command props (see docs)
+
+END
our $self;
our ($noact,$dump);
our $target;
+sub print_usage () {
+ print $usage or die $!;
+ exit 0;
+}
+
sub read_or_enoent ($) {
my ($fn) = @_;
if (!open R, '<', $fn) {
}
if (m{^-[^-]}) {
while (m{^-.}) {
- if (s{^-v}{-}) {
+ if (s{^-h}{-}) {
+ print_usage();
+ } elsif (s{^-v}{-}) {
$verbose++;
} elsif (s{^-q}{-}) {
$verbose=0;
$not_a_nailing_opt->();
}
}
+ } elsif (s{^--help$}{}) {
+ print_usage();
} elsif (s{^--target=}{}) {
$target = $_;
} elsif (m{^--(on|off)line$}) {