From a562d544d8520a0f113ad1a348e28ea00f27b693 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 3 Oct 2012 16:37:06 -0400 Subject: When ‘--help’ is given, just run ‘man’ to show the manual page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I.e. do what git does. I'm too lazy to keep the builtin help text up to date :-) Also add ‘--help’ to various commands that lacked it (e.g. nix-collect-garbage). --- src/nix-hash/Makefile.am | 7 +------ src/nix-hash/help.txt | 9 --------- src/nix-hash/nix-hash.cc | 3 +-- 3 files changed, 2 insertions(+), 17 deletions(-) delete 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 a4fdb324629d..ef7bb8423980 100644 --- a/src/nix-hash/Makefile.am +++ b/src/nix-hash/Makefile.am @@ -1,13 +1,8 @@ bin_PROGRAMS = nix-hash -nix_hash_SOURCES = nix-hash.cc help.txt +nix_hash_SOURCES = nix-hash.cc nix_hash_LDADD = ../libmain/libmain.la ../libstore/libstore.la ../libutil/libutil.la \ ../boost/format/libformat.la -nix-hash.o: help.txt.hh - -%.txt.hh: %.txt - ../bin2c/bin2c helpText < $< > $@ || (rm $@ && exit 1) - AM_CXXFLAGS = \ -I$(srcdir)/.. -I$(srcdir)/../libutil -I$(srcdir)/../libstore -I$(srcdir)/../libmain diff --git a/src/nix-hash/help.txt b/src/nix-hash/help.txt deleted file mode 100644 index 6c166f4995d8..000000000000 --- a/src/nix-hash/help.txt +++ /dev/null @@ -1,9 +0,0 @@ -Usage: nix-hash [OPTIONS...] [FILES...] - -`nix-hash' computes and prints cryptographic hashes for the specified -files. - - --flat: compute hash of regular file contents, not metadata - --base32: print hash in base-32 instead of hexadecimal - --type HASH: use hash algorithm HASH ("md5" (default), "sha1", "sha256") - --truncate: truncate the hash to 160 bits diff --git a/src/nix-hash/nix-hash.cc b/src/nix-hash/nix-hash.cc index 5b35ccd9dae3..af3dda4ad7b8 100644 --- a/src/nix-hash/nix-hash.cc +++ b/src/nix-hash/nix-hash.cc @@ -1,6 +1,5 @@ #include "hash.hh" #include "shared.hh" -#include "help.txt.hh" #include @@ -10,7 +9,7 @@ using namespace nix; void printHelp() { - std::cout << string((char *) helpText); + showManPage("nix-hash"); } -- cgit 1.4.1