about summary refs log tree commit diff
path: root/src/nix-instantiate
diff options
context:
space:
mode:
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 91843f66341b..7a04e932eb51 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 000000000000..fbe9d92dbfea
--- /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 50a4991a53a8..305c3b551ca5 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);