From 2320bb94c426ed16b6f9623d06f151ac811d50bd Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Tue, 31 Jul 2012 22:24:30 -0400 Subject: Make oh-parsechangelog use locale library. --- diff --git a/locale/en_US.sh b/locale/en_US.sh index 392aca0..d8bd284 100644 --- a/locale/en_US.sh +++ b/locale/en_US.sh @@ -102,3 +102,6 @@ oh_str_cant_make_config_dest_dir='Can'\''t make directory "%s" for platform conf oh_str_no_config_dir='No platform configuration files found' oh_str_copying_config_file='Copying configuration file "%s" to "%s"...' oh_str_cant_copy_config_file='Can'\''t copy configuration file' + +# oh-parsechangelog strings: +oh_str_usage_oh_parsechangelog='Usage: oh-parsechangelog' diff --git a/src/oh-parsechangelog.sh b/src/oh-parsechangelog.sh index 1b72ce3..9935d8b 100644 --- a/src/oh-parsechangelog.sh +++ b/src/oh-parsechangelog.sh @@ -19,27 +19,33 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -. @@LIBDIR@@/opkhelper/changelog - -print_usage() -{ - printf 'Usage: %s\n' "${1}" -} +. @@LIBDIR@@/messages +. @@LIBDIR@@/locale +. @@LIBDIR@@/changelog main() { - oh_changelog_parse changelog output + oh_locale_set - return 0 + if [ "${#}" -ne 0 ]; then + oh_usage + exit 1 + fi + + oh_changelog_parse changelog output } output() { + # These strings are machine-readable output and should not be localized or + # printed with oh_info(). + printf 'Source: %s\nVersion: %s\nDistribution: %s\n' \ "${OH_CHANGELOG_SOURCE}" "${OH_CHANGELOG_VERSION}" \ "${OH_CHANGELOG_DISTRIBUTION}" printf 'Maintainer: %s\nDate: %s\n' \ "${OH_CHANGELOG_MAINTAINER}" "${OH_CHANGELOG_DATE}" + printf 'Changes:\n' while IFS= read -r line; do if [ -z "${line}" ]; then @@ -54,4 +60,4 @@ EOF return 1 } -main +main "${@}" -- cgit v0.9.1