chiark / gitweb /
Get options right for "cargo fmt"
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 10 Oct 2020 15:50:24 +0000 (16:50 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 10 Oct 2020 15:50:24 +0000 (16:50 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
nailing-cargo

index 731ef5cc749b54b4f21fd0fae6bd397fbc83cbf7..e06a8a671ee6ef702468c040246f3a9632e026e6 100755 (executable)
@@ -101,13 +101,14 @@ our $linkfarm_depth;
 
 #
 our %subcmd_props = (
-# build (default)  =>[qw(                                        )],
-'generate-lockfile'=>[qw( lock-update !target        !target-dir )],
- update            =>[qw( lock-update !target online             )],
- fetch             =>[qw(                     online !target-dir )],
+# build (default)  =>[qw(                                                )],
+'generate-lockfile'=>[qw( lock-update !target          !target-dir       )],
+ update            =>[qw( lock-update !target online                     )],
+ fetch             =>[qw(                     online   !target-dir       )],
+ fmt               =>[qw( !locked     !target !offline !target-dir edits )],
                    );
 
-our @subcmd_xprops = qw(!manifest-path !offline !locked);
+our @subcmd_xprops = qw(!manifest-path);
 
 our @configs;
 our $verbose=1;
@@ -594,6 +595,11 @@ sub addargs () {
 
   push @add, "--offline" unless $online || subcmd_p('!offline');
 
+  if (subcmd_p('edits') && $linkfarm_depth ne '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";
+  }
+
   push @args_preface, @add if $pass_options;
   die if grep { m/ / } @add;
   $ENV{NAILINGCARGO_CARGO_OPTIONS} = "@add";