diff options
Diffstat (limited to 'src/nix-env')
-rw-r--r-- | src/nix-env/Makefile.am | 5 | ||||
-rw-r--r-- | src/nix-env/help.txt | 31 | ||||
-rw-r--r-- | src/nix-env/main.cc | 11 |
3 files changed, 43 insertions, 4 deletions
diff --git a/src/nix-env/Makefile.am b/src/nix-env/Makefile.am index add54581b051..32e7a8111ebc 100644 --- a/src/nix-env/Makefile.am +++ b/src/nix-env/Makefile.am @@ -6,6 +6,11 @@ nix_env_LDADD = ../libmain/libmain.a ../libexpr/libexpr.a \ ../boost/format/libformat.a -L../../externals/inst/lib -ldb_cxx \ -lsglr -lATB -lconversion -lasfix2 -lmept -lATerm +main.o: help.txt.hh + +%.txt.hh: %.txt + ../bin2c/bin2c helpText < $< > $@ || (rm $@ && exit 1) + AM_CXXFLAGS = \ -I.. -I../../externals/inst/include -I../libutil -I../libstore \ -I../libexpr -I../libmain diff --git a/src/nix-env/help.txt b/src/nix-env/help.txt new file mode 100644 index 000000000000..69c4742944fd --- /dev/null +++ b/src/nix-env/help.txt @@ -0,0 +1,31 @@ +nix-env [OPTIONS...] [ARGUMENTS...] + +`nix-env' is a tool to manipulate Nix user environments. + +Operations: + + --install / -i FILE: add a derivation to the user environment + --uninstall / -u: remove a derivation to the user environment + --query / -q: perform a query on an environment or Nix expression + +The previous operations take a list of derivation names. The special +name `*' may be used to indicate all derivations. + + --version: output version information + --help: display help + +Query types: + + --name: print derivation names (default) + --expr / -e: print derivation store expression + --status / -s: print installed/present status + +Query sources: + + --installed: use installed derivations (default) + --available / -f FILE: use derivations available in expression FILE + +Options: + + --verbose / -v: verbose operation (may be repeated) + --keep-failed / -K: keep temporary directories of failed builds diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc index 3c72a7950727..829e2f4ae508 100644 --- a/src/nix-env/main.cc +++ b/src/nix-env/main.cc @@ -3,6 +3,7 @@ #include "shared.hh" #include "parser.hh" #include "eval.hh" +#include "help.txt.hh" typedef void (* Operation) (EvalState & state, @@ -20,6 +21,12 @@ struct DrvInfo typedef map<Path, DrvInfo> DrvInfos; +void printHelp() +{ + cout << string((char *) helpText, sizeof helpText); +} + + bool parseDerivation(EvalState & state, Expr e, DrvInfo & drv) { ATMatcher m; @@ -395,10 +402,6 @@ void run(Strings args) op = opUninstall; else if (arg == "--query" || arg == "-q") op = opQuery; - else if (arg == "--verbose" || arg == "-v") - verbosity = (Verbosity) ((int) verbosity + 1); - else if (arg[0] == '-') - opFlags.push_back(arg); else opArgs.push_back(arg); |