--doc --man --manual Display complete manual (in w3m)
--leave-nailed Leave the nailed Cargo.toml in place
-E | --edits-sources Allow source edits (repeat: file creation)
+ -f | --force Override some warnings
--linkfarm[=no|shallow|git|full] (default varies, usually "no")
--just-linkfarm | --clean-linkfarm | --keep-linkfarm (default is keep)
--[no-]preclean-build[=no|src|full] (default is no)
our @configs;
our $verbose=1;
+our $force=0;
+our $forced=0;
our ($noact,$dump);
our $target;
die "$self: exec sh failed: $!";
}
+sub forceable_warning ($) {
+ my ($m) = @_;
+ print STDERR "$self: *WARNING*: $m\n";
+ if ($force) {
+ print STDERR "$self: continuing because of --force...\n" unless $forced++;
+ return;
+ } else {
+ die "$self: Stopping due to warning (override with -f | --force)\n";
+ }
+}
+
sub read_or_enoent ($) {
my ($fn) = @_;
if (!open R, '<', $fn) {
if ($linkfarm_depth eq 'copy-edit-all') {
$oot_preclean //= 'src';
if ($oot_preclean !~ m/^(?:src|full)$/) {
- print STDERR
- "$self: *WARNING*: -EE specified, but also --preclean=no; will probably leave your source tree full of junk\n";
+ forceable_warning
+ "-EE specified, but also --preclean=no; will probably leave your source tree full of junk";
}
}
push @add, "--offline" unless $online || subcmd_p('!offline');
if (subcmd_p('creates') && $linkfarm_depth !~ m/^copy-edit-all/) {
- print STDERR
- "$self: *WARNING*: this subcommand expects to create new source files; you probably want to specify --edits-sources twice aka -EE (which is not the default even now, for safety reasons)\n";
+ forceable_warning
+ "this subcommand expects to create new source files; you probably want to specify --edits-sources twice aka -EE (which is not the default even now, for safety reasons)";
} elsif (subcmd_p('edits') && $linkfarm_depth !~ m/^copy-edit/) {
- print STDERR
- "$self: *WARNING*: this subcommand expects to edit the source code; you probably want to specify --edits-sources aka -E (which is not the default even now, for safety reasons)\n";
+ forceable_warning
+ "this subcommand expects to edit the source code; you probably want to specify --edits-sources aka -E (which is not the default even now, for safety reasons)";
}
push @args_preface, @add if $pass_options;
$verbose=0;
} elsif (s{^-n}{-}) {
$noact++;
+ } elsif (s{^-f}{-}) {
+ $force++;
} elsif (s{^-s(.+)}{-}s) {
$cargo_subcmd = $1;
} elsif (s{^-([uU])}{-}) {
$linkfarm_depth = $1 || 'git';
} elsif (m{^--edits?-sources?$}) {
$edits_sources->();
+ } elsif (m{^--force$}) {
+ $force++;
} elsif (m{^--just-run$}) {
$do_nail = $do_cargo_lock = $do_lock = 0;
} elsif (m{^--(clean|keep)-linkfarm$}) {
oot_absdir => $oot_absdir,
build_absdir => $build_absdir,
linkfarm_depth => $linkfarm_depth,
- oot_preclean => $oot_preclean, });
+ oot_preclean => $oot_preclean,
+ force => $force,,
+ forced => $forced,});
' or die $@;
}