diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-02-21T23·00+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-02-21T23·00+0000 |
commit | 0db450024dbeadf0c595a6de8743b7cb8f3dcbcd (patch) | |
tree | e326be8e321da81f88ab6e7ab195f8c83998e1f8 /src/nix-store | |
parent | 9da367b7d5e7c71efd802b87c99c11faff141499 (diff) |
* Export/import many paths in one go.
Diffstat (limited to 'src/nix-store')
-rw-r--r-- | src/nix-store/nix-store.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index 293becc6869f..9c4790039ec4 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -623,9 +623,13 @@ static void opExport(Strings opFlags, Strings opArgs) i != opFlags.end(); ++i) if (*i == "--sign") sign = true; else throw UsageError(format("unknown flag `%1%'") % *i); - + FdSink sink(STDOUT_FILENO); - store->exportPath(*opArgs.begin(), sign, sink); + for (Strings::iterator i = opArgs.begin(); i != opArgs.end(); ++i) { + writeInt(1, sink); + store->exportPath(*i, sign, sink); + } + writeInt(0, sink); } @@ -635,7 +639,8 @@ static void opImport(Strings opFlags, Strings opArgs) if (!opArgs.empty()) throw UsageError("no arguments expected"); FdSource source(STDIN_FILENO); - cout << format("%1%\n") % store->importPath(false, source); + while (readInt(source) == 1) + cout << format("%1%\n") % store->importPath(false, source); } |