about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nix/command.cc16
-rw-r--r--src/nix/command.hh2
-rw-r--r--src/nix/copy.cc1
3 files changed, 16 insertions, 3 deletions
diff --git a/src/nix/command.cc b/src/nix/command.cc
index f69c56896567..0f6bb294b38c 100644
--- a/src/nix/command.cc
+++ b/src/nix/command.cc
@@ -100,9 +100,21 @@ void StoreCommand::run()
     run(getStore());
 }
 
-StorePathsCommand::StorePathsCommand()
+StorePathsCommand::StorePathsCommand(bool recursive)
+    : recursive(recursive)
 {
-    mkFlag('r', "recursive", "apply operation to closure of the specified paths", &recursive);
+    if (recursive)
+        mkFlag()
+            .longName("no-recursive")
+            .description("apply operation to specified paths only")
+            .set(&this->recursive, false);
+    else
+        mkFlag()
+            .longName("recursive")
+            .shortName('r')
+            .description("apply operation to closure of the specified paths")
+            .set(&this->recursive, true);
+
     mkFlag(0, "all", "apply operation to the entire store", &all);
 }
 
diff --git a/src/nix/command.hh b/src/nix/command.hh
index 82400f31c078..bf897f620db6 100644
--- a/src/nix/command.hh
+++ b/src/nix/command.hh
@@ -141,7 +141,7 @@ private:
 
 public:
 
-    StorePathsCommand();
+    StorePathsCommand(bool recursive = false);
 
     using StoreCommand::run;
 
diff --git a/src/nix/copy.cc b/src/nix/copy.cc
index 8d7c6a0e8e4c..071ac3890aa9 100644
--- a/src/nix/copy.cc
+++ b/src/nix/copy.cc
@@ -17,6 +17,7 @@ struct CmdCopy : StorePathsCommand
     SubstituteFlag substitute = NoSubstitute;
 
     CmdCopy()
+        : StorePathsCommand(true)
     {
         mkFlag(0, "from", "store-uri", "URI of the source Nix store", &srcUri);
         mkFlag(0, "to", "store-uri", "URI of the destination Nix store", &dstUri);