From 078e20885e0805e04669f9b334a516a6d8d12763 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 1 Dec 2003 15:55:05 +0000 Subject: * Help text for all (non-script) programs, so no more: $ nix-instantiate --help error: unknown flag `--help` Try `nix-instantiate --help' for more information. :-) --- src/nix-hash/Makefile.am | 5 +++++ src/nix-hash/help.txt | 6 ++++++ src/nix-hash/nix-hash.cc | 7 +++++++ 3 files changed, 18 insertions(+) create mode 100644 src/nix-hash/help.txt (limited to 'src/nix-hash') diff --git a/src/nix-hash/Makefile.am b/src/nix-hash/Makefile.am index 8609cb2164..154f7a2760 100644 --- a/src/nix-hash/Makefile.am +++ b/src/nix-hash/Makefile.am @@ -4,5 +4,10 @@ nix_hash_SOURCES = nix-hash.cc nix_hash_LDADD = ../libmain/libmain.a ../libstore/libstore.a ../libutil/libutil.a \ ../boost/format/libformat.a -L../../externals/inst/lib -ldb_cxx -lATerm +nix-hash.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../libmain diff --git a/src/nix-hash/help.txt b/src/nix-hash/help.txt new file mode 100644 index 0000000000..84ba152c5a --- /dev/null +++ b/src/nix-hash/help.txt @@ -0,0 +1,6 @@ +nix-hash [OPTIONS...] [FILES...] + +`nix-hash computes and prints cryptographic hashes for the specified +files. + + --flat: compute hash of regular file contents, not metadata diff --git a/src/nix-hash/nix-hash.cc b/src/nix-hash/nix-hash.cc index 77c169b9a9..23309ff746 100644 --- a/src/nix-hash/nix-hash.cc +++ b/src/nix-hash/nix-hash.cc @@ -2,6 +2,13 @@ #include "hash.hh" #include "shared.hh" +#include "help.txt.hh" + + +void printHelp() +{ + cout << string((char *) helpText, sizeof helpText); +} void run(Strings args) -- cgit 1.4.1