about summary refs log tree commit diff
path: root/src/nix-instantiate/nix-instantiate.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-05-07T14·46+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-05-07T14·46+0000
commit83dfa898706e1faa491b3a50ea20baf60abda387 (patch)
treec498fcd4428bd53f41415b027bc9eb5f044c5e95 /src/nix-instantiate/nix-instantiate.cc
parent01e58adce0767f1a484d80fcbcf67c7945cbc146 (diff)
parent4750065ada362bd46e85879975a3148e18df5b0c (diff)
* Sync with the trunk.
Diffstat (limited to 'src/nix-instantiate/nix-instantiate.cc')
-rw-r--r--src/nix-instantiate/nix-instantiate.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc
index c61cf89c90e4..4d629ea1b333 100644
--- a/src/nix-instantiate/nix-instantiate.cc
+++ b/src/nix-instantiate/nix-instantiate.cc
@@ -39,7 +39,7 @@ static bool indirectRoot = false;
 
 void processExpr(EvalState & state, const Strings & attrPaths,
     bool parseOnly, bool strict, const Bindings & autoArgs,
-    bool evalOnly, bool xmlOutput, Expr * e)
+    bool evalOnly, bool xmlOutput, bool location, Expr * e)
 {
     if (parseOnly)
         std::cout << format("%1%\n") % *e;
@@ -52,7 +52,7 @@ void processExpr(EvalState & state, const Strings & attrPaths,
             PathSet context;
             if (evalOnly)
                 if (xmlOutput)
-                    printValueAsXML(state, strict, v, std::cout, context);
+                    printValueAsXML(state, strict, location, v, std::cout, context);
                 else {
                     if (strict) state.strictForceValue(v);
                     std::cout << v << std::endl;
@@ -83,6 +83,7 @@ void run(Strings args)
     bool evalOnly = false;
     bool parseOnly = false;
     bool xmlOutput = false;
+    bool xmlOutputSourceLocation = true;
     bool strict = false;
     Strings attrPaths;
     Bindings autoArgs;
@@ -116,6 +117,8 @@ void run(Strings args)
             indirectRoot = true;
         else if (arg == "--xml")
             xmlOutput = true;
+        else if (arg == "--no-location")
+            xmlOutputSourceLocation = false;
         else if (arg == "--strict")
             strict = true;
         else if (arg[0] == '-')
@@ -131,14 +134,14 @@ void run(Strings args)
     if (readStdin) {
         Expr * e = parseStdin(state);
         processExpr(state, attrPaths, parseOnly, strict, autoArgs,
-            evalOnly, xmlOutput, e);
+            evalOnly, xmlOutput, xmlOutputSourceLocation, e);
     }
 
     foreach (Strings::iterator, i, files) {
         Path path = absPath(*i);
         Expr * e = parseExprFromFile(state, path);
         processExpr(state, attrPaths, parseOnly, strict, autoArgs,
-            evalOnly, xmlOutput, e);
+            evalOnly, xmlOutput, xmlOutputSourceLocation, e);
     }
 
     state.printStats();