summary refs log tree commit diff
path: root/src/nix-instantiate
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-12-01 15:55:05 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-12-01 15:55:05 +0000
commit078e20885e0805e04669f9b334a516a6d8d12763 (patch)
treef16741a27866a46806c99ec8d5c8371ae5298046 /src/nix-instantiate
parent905d5b91fa6fa64e549f9019f9fab4150f00c13a (diff)
downloadguix-078e20885e0805e04669f9b334a516a6d8d12763.tar.gz
* Help text for all (non-script) programs, so no more:
$ nix-instantiate --help
error: unknown flag `--help`
Try `nix-instantiate --help' for more information.

:-)

Diffstat (limited to 'src/nix-instantiate')
-rw-r--r--src/nix-instantiate/Makefile.am5
-rw-r--r--src/nix-instantiate/help.txt15
-rw-r--r--src/nix-instantiate/main.cc11
3 files changed, 28 insertions, 3 deletions
diff --git a/src/nix-instantiate/Makefile.am b/src/nix-instantiate/Makefile.am
index 91843f6634..7a04e932eb 100644
--- a/src/nix-instantiate/Makefile.am
+++ b/src/nix-instantiate/Makefile.am
@@ -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
diff --git a/src/nix-instantiate/help.txt b/src/nix-instantiate/help.txt
new file mode 100644
index 0000000000..fbe9d92dbf
--- /dev/null
+++ b/src/nix-instantiate/help.txt
@@ -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)
diff --git a/src/nix-instantiate/main.cc b/src/nix-instantiate/main.cc
index 50a4991a53..305c3b551c 100644
--- a/src/nix-instantiate/main.cc
+++ b/src/nix-instantiate/main.cc
@@ -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);