changeset 81:124faa20ae80

Implemented a "-V" global option to print the program's name and version number to stdout
author Franz Glasner <fzglas.hg@dom66.de>
date Fri, 16 Aug 2019 09:16:27 +0200
parents f5cf08e8d246
children edd49e4887dd
files Makefile bin/check-ports bin/fjail
diffstat 3 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Thu Aug 15 23:26:39 2019 +0200
+++ b/Makefile	Fri Aug 16 09:16:27 2019 +0200
@@ -40,6 +40,7 @@
 	${SED} -i "" -e "s|\\\$$Header\\\$$|\$$Header: ${_rp} ${HGREVISION} ${HGDATE} ${HGAUTHOR} ${HGPHASE} \$$|" ${WRKSRC}/${_rp}
 	${SED} -i "" -e "s|\\\$$HGid\\\$$|\$$HGid: ${HGPATH}/${_rp} ${HGREVISION} ${HGDATE} ${HGAUTHOR} ${HGPHASE} \$$|" ${WRKSRC}/${_rp}
 	${SED} -i "" -e "s|@@VERSION@@|${PORTVERSION}|" ${WRKSRC}/${_rp}
+	${SED} -i "" -e "s|@@HGREVISION@@|${HGREVISION}|" ${WRKSRC}/${_rp}
 	${SED} -i "" -e "s|@@ETCDIR@@|${ETCDIR}|" ${WRKSRC}/${_rp}
 	${SED} -i "" -e "s|@@INDEXFILE@@|${INDEXFILE}|" ${WRKSRC}/${_rp}
 .endfor
--- a/bin/check-ports	Thu Aug 15 23:26:39 2019 +0200
+++ b/bin/check-ports	Fri Aug 16 09:16:27 2019 +0200
@@ -203,8 +203,12 @@
 short_flag=""
 verbose_flag=""
 
-while getopts "Aasv" _opt ; do
+while getopts "VAasv" _opt ; do
     case ${_opt} in
+	V)
+            echo "check-ports v${VERSION} (rv:@@HGREVISION@@)"
+            exit 0
+	    ;;
         A)
             # print for every package the status of all repositories
             alldata_flag=1
--- a/bin/fjail	Thu Aug 15 23:26:39 2019 +0200
+++ b/bin/fjail	Fri Aug 16 09:16:27 2019 +0200
@@ -11,6 +11,8 @@
 
 OPTIONS:
 
+  -V    Print the program name and version number to stdout and exit
+
   -h    Print this help message to stdout and exit
 
 COMMANDS:
@@ -230,8 +232,12 @@
 #
 # Global option handling
 #
-while getopts "h" _opt ; do
+while getopts "Vh" _opt ; do
     case ${_opt} in
+        V)
+            echo "fjail v${VERSION} (rv:@@HGREVISION@@)"
+            exit 0
+            ;;
         h)
             echo "${USAGE}"
             exit 0