From: Ian Jackson Date: Sat, 25 Jul 2020 18:07:52 +0000 (+0100) Subject: Provide --leave-nailed option X-Git-Tag: nailing-cargo/1.0.0~66 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=dde9228e1cdd523811999300e22f8db4d6cdbe71;p=nailing-cargo.git Provide --leave-nailed option Signed-off-by: Ian Jackson --- diff --git a/README.md b/README.md index 0a6b478..e7a5c52 100644 --- a/README.md +++ b/README.md @@ -353,7 +353,6 @@ Options * `!target`: cargo would reject `--target=`; in this case nailing-cargo's `-T` option is ineffective. * `!target-dir`: cargo would reject `--target-dir`, so don't pass it. (Usually we pass `--target-dir=target` when we pass `--manifest-path`, since cargo's default is `target` in the same directory as `Cargo.toml`.) - There are also some properties which should not be needed, but are provided for completeness. Do not use these to solve the problem of nailing-cargo passing cargo options to a build command which is @@ -363,10 +362,18 @@ Options * `!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. + * `--just-linkfarm`: Make the out-of-tree linkfarm as if for `--cargo-lock-update`, but do not actually run any command, nor try to copy back a a generated `Cargo.lock`. + * `--leave-nailed`: At the end, leave all the `Cargo.toml` files in + their edited state, rather than (trying to) clean them up. To + clean this up later, run `nailing-cargo` again without this option. + Without this option, the nailed versions are left in + `.Cargo.toml.nailed~`, so you only need this if you want to run + cargo by hand or something. + * `-h` | `--help`: Print usage summary. * `--man` | `--manual`: Format this manual into html using `pandoc` diff --git a/nailing-cargo b/nailing-cargo index cfcb97b..1066718 100755 --- a/nailing-cargo +++ b/nailing-cargo @@ -27,6 +27,7 @@ options: -h --help Print this message --man --manual Display complete manual (in w3m) --just-linkfarm Make the linkfarm as for -u, then stop + --leave-nailed Leave the nailed Cargo.toml in place -s Treat command as `cargo ` --subcommand-props=,... Override command props (see docs) @@ -87,6 +88,7 @@ our $cargo_lock_update; our $pass_options; our $online; our $just_linkfarm; +our $leave_nailed; # our %subcmd_props = ( @@ -928,6 +930,8 @@ sub parse_args () { } elsif (m{^--just-linkfarm$}) { $just_linkfarm = 1; $cargo_lock_update= 1; + } elsif (m{^--leave-nailed$}) { + $leave_nailed = 1; } elsif (s{^--subcommand-props=}{}) { my @props = split /\,/, $_; our %subcmd_prop_ok; @@ -1007,7 +1011,7 @@ if ($dump) { exit 0 if $noact; -$want_uninstall = 1; +$want_uninstall = !$leave_nailed; makebackups(); install(); @@ -1021,7 +1025,7 @@ my $estatus = invoke(); cargo_lock_update_after(); -uninstall(); +uninstall() unless $leave_nailed; $want_uninstall = 0; print STDERR "$self: unnailed. status $estatus.\n" if $verbose;