From 7ae90a0bacbfbbd4c3bc9d716b7f52e2e90e07fe Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 11 Oct 2013 23:08:42 -0400 Subject: version: New command. --- diff --git a/NEWS b/NEWS index f3b11f8..e827aa8 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ Changes in this release: * The process-incoming command now removes processed files. * All output is now sent to stderr. (Previously, only some of it was.) * An example archive "conf" file is now provided in the source tree. + * A new "version" command and "-V" option have been added. ProteanOS Archive Manager version 1.0.0 --------------------------------------- diff --git a/lib/cmd/local.mk b/lib/cmd/local.mk index a41a1a8..5687a3e 100644 --- a/lib/cmd/local.mk +++ b/lib/cmd/local.mk @@ -3,6 +3,7 @@ pkglibcmd_srcs = \ lib/cmd/help.sh \ + lib/cmd/version.sh \ lib/cmd/include.sh \ lib/cmd/process-incoming.sh \ lib/cmd/remove.sh \ diff --git a/lib/cmd/version.sh b/lib/cmd/version.sh new file mode 100644 index 0000000..e1d27b4 --- /dev/null +++ b/lib/cmd/version.sh @@ -0,0 +1,30 @@ +# pro-archman +# lib/cmd/version.sh +# "version" command +# +# Copyright (C) 2013 Patrick "P. J." McDermott +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +cmd_version_main() +{ + printf '%s %s\n' "${PACKAGE_NAME}" "${PACKAGE_VERSION}" + + cat < +This is free software: you are free to change and redistribute it. +There is NO WARRANTY, to the extent permitted by law. +EOF +} diff --git a/locale/en_US/pro_archman.sh b/locale/en_US/pro_archman.sh index 21404c6..ce569b1 100644 --- a/locale/en_US/pro_archman.sh +++ b/locale/en_US/pro_archman.sh @@ -30,6 +30,10 @@ msg_pro_archman_cmd_help_summary_head='Where is one of:' msg_pro_archman_cmd_help_summary='print this help message' msg_pro_archman_cmd_help_usage='[]' +# lib/cmd/version.sh +msg_pro_archman_cmd_version_summary='print version information' +msg_pro_archman_cmd_version_usage='' + # lib/cmd/include.sh msg_pro_archman_cmd_include_summary='include packages described in changes files' msg_pro_archman_cmd_include_usage=' ...' diff --git a/man/pro-archman.1in b/man/pro-archman.1in index 174bd9d..4ff5137 100644 --- a/man/pro-archman.1in +++ b/man/pro-archman.1in @@ -19,6 +19,9 @@ manages packages in an archive. .B help Print a help message. .TP +.B version +Print version information. +.TP .B include \fIchanges\fP \fR...\fP Include packages described in changes files. .TP diff --git a/src/pro-archman.sh b/src/pro-archman.sh index 8996367..8df75f1 100644 --- a/src/pro-archman.sh +++ b/src/pro-archman.sh @@ -22,6 +22,8 @@ set -u # Constant global variables +PACKAGE_NAME='@@PACKAGE_NAME@@' +PACKAGE_VERSION='@@PACKAGE_VERSION@@' PKGLIBDIR='@@PKGLIBDIR@@' PKGLIBCMDDIR='@@PKGLIBCMDDIR@@' PKGLIBCMD='@@PKGLIBCMD@@' @@ -123,7 +125,7 @@ get_options() { local opt= - while getopts 'b:h' opt; do + while getopts 'b:hV' opt; do case "${opt}" in 'b') opt_base_dir="$(cd "${OPTARG}" && pwd)" @@ -131,6 +133,9 @@ get_options() 'h') opt_cmd='help' ;; + 'V') + opt_cmd='version' + ;; esac done -- cgit v0.9.1