From cb46c84de5a2f4de3b76f92d2cf1c3adad763f73 Mon Sep 17 00:00:00 2001 From: mdiluzio Date: Tue, 30 Dec 2014 19:23:03 +0000 Subject: [PATCH] Actually use real version number in the man page --- CMakeLists.txt | 2 +- scripts/gen_manpage.sh | 12 +++++++----- scripts/gen_usage.sh | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b757b5..2c8bf5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ install( FILES scripts/ttrts_complete DESTINATION /etc/bash_completion.d/ ) # Run the gen_usage script to generate our usage header add_custom_target( ttrts-gen-manpage ALL - ${CMAKE_SOURCE_DIR}/scripts/gen_manpage.sh "ttrts.6" "${CMAKE_SOURCE_DIR}/source/client/README.md" + ${CMAKE_SOURCE_DIR}/scripts/gen_manpage.sh "${TTRTS_VERSION_MAJOR}" "${TTRTS_VERSION_MINOR}" "${TTRTS_VERSION_PATCH}" "ttrts.6" "${CMAKE_SOURCE_DIR}/source/client/README.md" ) # Install the ttrts man page diff --git a/scripts/gen_manpage.sh b/scripts/gen_manpage.sh index ccb211d..9b7e02a 100755 --- a/scripts/gen_manpage.sh +++ b/scripts/gen_manpage.sh @@ -1,10 +1,12 @@ #! /bin/bash # Used to a man page from markdown -echo ".\" Man page for the ttrts project" > $1 -echo ".\" this man page is auto-generated, do not edit directly" >> $1 -echo ".TH TTRTS\ v0.3.0 6 $(date +%Y-%m-%d) http://mdiluz.github.io/ttrts/" >> $1 + +echo ".\" Man page for the ttrts project" > $4 +echo ".\" this man page is auto-generated, do not edit directly" >> $4 + +echo ".TH TTRTS\ v$1.$2.$3 6 $(date +%Y-%m-%d) http://mdiluz.github.io/ttrts/" >> $4 # sections to section headers # sub-sections in man page sub-sections @@ -16,7 +18,7 @@ echo ".TH TTRTS\ v0.3.0 6 $(date +%Y-%m-%d) http://mdiluz.github.io/ttrts/" >> $ # Put all back-ticks quotes in bold # underline mapfile opt # ensure name section uses correct -cat "$2" \ +cat "$5" \ | sed -r 's/^# (\w+)/.SH \1/g' \ | sed -r 's/^##+ (\w+)/.SS \1/g' \ | sed -r 's/^ (.*)$/\n\t\1\n/g' \ @@ -26,4 +28,4 @@ cat "$2" \ | sed -r 's/-----+//g' \ | sed -r 's/`(.*?)`/\\fB\1\\fR/g' \ | sed -r 's/MAPFILE/\\fImapfile\\fR/g' \ - | sed -r 's/\tttrts -/\tttrts \\-/g' >> $1 + | sed -r 's/\tttrts -/\tttrts \\-/g' >> $4 diff --git a/scripts/gen_usage.sh b/scripts/gen_usage.sh index 8bc0f7b..c989b2d 100755 --- a/scripts/gen_usage.sh +++ b/scripts/gen_usage.sh @@ -1,7 +1,7 @@ #! /bin/bash # Used to generate usage text from markdown cat README.md \ - | sed 's/^#\+ //g' \ + | sed 's/^#\+ //g' \ | sed 's/^\t/\\t/g' \ | sed 's/^ /\\t/g' \ | sed ':a;N;$!ba;s/\n/\\n\n/g' \