* Help text for all (non-script) programs, so no more:

$ nix-instantiate --help
error: unknown flag `--help`
Try `nix-instantiate --help' for more information.

:-)
This commit is contained in:
Eelco Dolstra 2003-12-01 15:55:05 +00:00
parent 905d5b91fa
commit 078e20885e
14 changed files with 126 additions and 32 deletions

View file

@ -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

31
src/nix-env/help.txt Normal file
View file

@ -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

View file

@ -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);