Hi all,
This patch adds and documents the "--from-file" option which allows
parsing a file (or stdin) for additional arguments to the command. Note
that this patch is NOT YET TESTED, I'm sending it here while I work on
figuring out how to build nix from SVN in the hopes that someone might
already be equipped to do so and might test it in the mean time.
Cheers,
Shea Levy
Index: nix/src/libmain/shared.cc
===================================================================
--- nix/src/libmain/shared.cc (revision 28396)
+++ nix/src/libmain/shared.cc (working copy)
@@ -251,6 +251,20 @@
string value = *i;
overrideSetting(name, tokenizeString(value));
}
+ else if (arg == "--from-file") {
+ ++i;
+ if (i == args.end()) throw UsageError("`--from-file' requires an
argument");
+ ifstream argFile;
+ argFile.open(*i);
+ if (argFile.fail()) {
+ throw Error(format("failed to open option file `%1%'") % *i);
+ }
+ string fileArg;
+ while (argFile >> fileArg) {
+ args.push_back(fileArg);
+ }
+ fileArg.close();
+ }
else remaining.push_back(arg);
}
Index: nix/doc/manual/opt-common.xml
===================================================================
--- nix/doc/manual/opt-common.xml (revision 28396)
+++ nix/doc/manual/opt-common.xml (working copy)
@@ -341,6 +341,16 @@
</varlistentry>
+<varlistentry><term><option>--from-file</option>
<replaceable>file</replaceable></term>
+
+ <listitem><para>This option reads whitespace-separated options
+ from <replacable>file</replacable> and adds them to the argument list.
+ This can be particularly useful if <replacable>file</replacable>
+ is /dev/stdin.</para></listitem>
+
+</varlistentry>
+
+
</variablelist>
_______________________________________________
nix-dev mailing list
[email protected]
https://mail.cs.uu.nl/mailman/listinfo/nix-dev