diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-01-14T12·32+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2007-01-14T12·32+0000 |
commit | e418976107ed1581c108c82cd5b3b06c2f4ba9db (patch) | |
tree | e4346ab680095c66ecd49610548b18aa10c33a04 /src/nix-instantiate/nix-instantiate.cc | |
parent | 4e329f173f738dfc83e58bdb8ad2ced6c452a395 (diff) |
* Option --argstr for passing string arguments easily. (NIX-75)
Diffstat (limited to 'src/nix-instantiate/nix-instantiate.cc')
-rw-r--r-- | src/nix-instantiate/nix-instantiate.cc | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc index b49b84e36ae2..3822de5c6289 100644 --- a/src/nix-instantiate/nix-instantiate.cc +++ b/src/nix-instantiate/nix-instantiate.cc @@ -10,6 +10,7 @@ #include "expr-to-xml.hh" #include "util.hh" #include "store-api.hh" +#include "common-opts.hh" #include "help.txt.hh" @@ -112,15 +113,8 @@ void run(Strings args) throw UsageError("`--attr' requires an argument"); attrPaths.push_back(*i++); } - else if (arg == "--arg") { - if (i == args.end()) - throw UsageError("`--arg' requires two arguments"); - string name = *i++; - if (i == args.end()) - throw UsageError("`--arg' requires two arguments"); - Expr value = parseExprFromString(state, *i++, absPath(".")); - autoArgs.set(toATerm(name), value); - } + else if (parseOptionArg(arg, i, args.end(), state, autoArgs)) + ; else if (arg == "--add-root") { if (i == args.end()) throw UsageError("`--add-root' requires an argument"); |