diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-10-01T14·53+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-10-01T14·53+0200 |
commit | a3c4eb096456673b48f4fc35b76097d67e022141 (patch) | |
tree | 5b9d82e1e4994df85e47614841a7cfcddfbd4135 /src/nix-prefetch-url | |
parent | bec3c3160881fcedf226080f13739aee81adae1a (diff) |
nix-prefetch-url: $PRINT_PATH -> --print-path
Diffstat (limited to 'src/nix-prefetch-url')
-rw-r--r-- | src/nix-prefetch-url/nix-prefetch-url.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/nix-prefetch-url/nix-prefetch-url.cc b/src/nix-prefetch-url/nix-prefetch-url.cc index bd52df1c74a3..cb6078fca1c7 100644 --- a/src/nix-prefetch-url/nix-prefetch-url.cc +++ b/src/nix-prefetch-url/nix-prefetch-url.cc @@ -48,6 +48,7 @@ int main(int argc, char * * argv) HashType ht = htSHA256; std::vector<string> args; Strings searchPath; + bool printPath = getEnv("PRINT_PATH") != ""; parseCmdLine(argc, argv, [&](Strings::iterator & arg, const Strings::iterator & end) { if (*arg == "--help") @@ -60,6 +61,8 @@ int main(int argc, char * * argv) if (ht == htUnknown) throw UsageError(format("unknown hash type ‘%1%’") % s); } + else if (*arg == "--print-path") + printPath = true; else if (parseSearchPathArg(arg, end, searchPath)) ; else if (*arg != "" && arg->at(0) == '-') @@ -123,10 +126,11 @@ int main(int argc, char * * argv) storePath = store->addToStore(name, tmpFile, false, ht); } - printMsg(lvlInfo, format("path is ‘%1%’") % storePath); + if (!printPath) + printMsg(lvlInfo, format("path is ‘%1%’") % storePath); std::cout << printHash16or32(hash) << std::endl; - if (getEnv("PRINT_PATH") != "") + if (printPath) std::cout << storePath << std::endl; }); } |