diff options
-rw-r--r-- | Makefile | 13 | ||||
-rw-r--r-- | hadori.1 | 33 | ||||
-rw-r--r-- | hadori.C | 7 |
3 files changed, 16 insertions, 37 deletions
@@ -20,13 +20,18 @@ CXXFLAGS?=-O2 -Wall CXXFLAGS+=-std=c++0x CPPFLAGS+=-D_FILE_OFFSET_BITS=64 -all: hadori +all: hadori.1 hadori.1: hadori - help2man -n $< -o $@ -N --version-string 0.1 ./$< + help2man -n $< -o $@ -N ./$< hadori: hadori.o -hadori.o: hadori.C inode.h +hadori.o: hadori.C inode.h version.h + +version.h: + test -d .git && git describe | sed 's/^\(.*\)$$/#define HADORI_VERSION "hadori \1"/' > $@ clean: - rm -f hadori hadori.o + rm -f hadori hadori.o hadori.1 + +.PHONY: version.h clean diff --git a/hadori.1 b/hadori.1 deleted file mode 100644 index df947f2..0000000 --- a/hadori.1 +++ /dev/null @@ -1,33 +0,0 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.40.5. -.TH HADORI "1" "January 2012" "hadori 0.1" "User Commands" -.SH NAME -hadori \- hadori -.SH DESCRIPTION -Invocation: hadori [ OPTIONS ] [ ARGUMENTS ] -OPTIONS: -.TP -\fB\-h\fR [ \fB\-\-help\fR ] -print this help message -.TP -\fB\-t\fR [ \fB\-\-no\-time\fR ] -ignore mtime -.TP -\fB\-\-hash\fR -use adler32 hash to speed up comparing many files with -same size and mostly identical content -.TP -\fB\-n\fR [ \fB\-\-dry\-run\fR ] -don't change anything, implies \fB\-\-verbose\fR -.TP -\fB\-v\fR [ \fB\-\-verbose\fR ] -show which files get linked -.TP -\fB\-d\fR [ \fB\-\-debug\fR ] -show files being examined -.TP -\fB\-s\fR [ \fB\-\-stdin\fR ] -read arguments from stdin, one per line; you can't -combine that with arguments on the commandline -.TP -\fB\-0\fR [ \fB\-\-null\fR ] -implies \fB\-\-stdin\fR, but use null bytes as delimiter @@ -36,6 +36,7 @@ namespace po = boost::program_options; #include <sysexits.h> #include "inode.h" +#include "version.h" // needed for equal_range and range-for namespace std { @@ -187,6 +188,7 @@ int main (int const argc, char ** argv) { po::options_description opts("OPTIONS"); opts.add_options() ("help,h", "print this help message") + ("version,V", "print version information") ("no-time,t", "ignore mtime") ("hash", "use adler32 hash to speed up comparing many files with same size and mostly identical content") ("dry-run,n", "don't change anything, implies --verbose") @@ -211,6 +213,11 @@ int main (int const argc, char ** argv) { return EX_OK; } + if (config.count("version")) { + std::cout << HADORI_VERSION << std::endl; + return EX_OK; + } + if (not config.count("debug")) debug.rdbuf(nullptr); if (not config.count("debug") and not config.count("verbose") and not config.count("dry-run")) |