mirror of
https://github.com/NixOS/nix.git
synced 2025-11-21 17:59:36 +01:00
* 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:
parent
905d5b91fa
commit
078e20885e
14 changed files with 126 additions and 32 deletions
|
|
@ -6,6 +6,11 @@ nix_instantiate_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
|
||||
|
|
|
|||
15
src/nix-instantiate/help.txt
Normal file
15
src/nix-instantiate/help.txt
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
nix-instantiate [OPTIONS...] [FILES...]
|
||||
|
||||
`nix-instantiate' turns Nix expressions into store expressions.
|
||||
|
||||
The argument `-' may be specified to read a Nix expression from
|
||||
standard input.
|
||||
|
||||
Options:
|
||||
|
||||
--version: output version information
|
||||
--help: display help
|
||||
|
||||
Options:
|
||||
|
||||
--verbose / -v: verbose operation (may be repeated)
|
||||
|
|
@ -6,6 +6,13 @@
|
|||
#include "shared.hh"
|
||||
#include "eval.hh"
|
||||
#include "parser.hh"
|
||||
#include "help.txt.hh"
|
||||
|
||||
|
||||
void printHelp()
|
||||
{
|
||||
cout << string((char *) helpText, sizeof helpText);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
|
|
@ -87,9 +94,7 @@ void run(Strings args)
|
|||
}
|
||||
else
|
||||
#endif
|
||||
if (arg == "--verbose" || arg == "-v")
|
||||
verbosity = (Verbosity) ((int) verbosity + 1);
|
||||
else if (arg == "-")
|
||||
if (arg == "-")
|
||||
readStdin = true;
|
||||
else if (arg[0] == '-')
|
||||
throw UsageError(format("unknown flag `%1%`") % arg);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue