diff options
author | P. J. McDermott <pjm@nac.net> | 2012-07-31 22:24:30 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2012-07-31 22:26:07 (EDT) |
commit | 2320bb94c426ed16b6f9623d06f151ac811d50bd (patch) | |
tree | 69ad37dfac26aa6ce48d2319a1bd859a12e2f225 | |
parent | c707416166cba430d1db4f568def3ceae58070db (diff) |
Make oh-parsechangelog use locale library.
-rw-r--r-- | locale/en_US.sh | 3 | ||||
-rw-r--r-- | src/oh-parsechangelog.sh | 24 |
2 files changed, 18 insertions, 9 deletions
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 <http://www.gnu.org/licenses/>. -. @@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 "${@}" |