From a95c249fbc6b556270d91b685b980f0cec986b23 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Tue, 31 Jul 2012 21:34:03 -0400 Subject: Add oh_usage and support oh-* utils in oh_help. --- diff --git a/lib/messages.sh b/lib/messages.sh index 3894778..c2c381e 100644 --- a/lib/messages.sh +++ b/lib/messages.sh @@ -64,9 +64,19 @@ oh_info() return 0 } +oh_usage() +{ + _util="$(echo "${0##*/}" | sed 's/-/_/g')" + _usage_str="$(eval echo "\$\{oh_str_usage_${_util}\}")" + : "${_usage_str:=${oh_str_usage_none}}" + printf '%s\n' "${_usage_str}" +} + oh_help() { - _help_str="$(eval echo "\$\{oh_str_help_${0##*/}\}")" + oh_usage + _util="$(echo "${0##*/}" | sed 's/-/_/g')" + _help_str="$(eval echo "\$\{oh_str_help_${_util}\}")" : "${_help_str:=${oh_str_help_none}}" printf '%s\n' "${_help_str}" } diff --git a/locale/en_US.sh b/locale/en_US.sh index b7d730a..520a372 100644 --- a/locale/en_US.sh +++ b/locale/en_US.sh @@ -18,6 +18,7 @@ # along with this program. If not, see . # General strings: +oh_str_usage_none='No usage found' oh_str_help_none='No help found' oh_str_version='%s (%s) %s Copyright (C) 2012 Patrick "P. J." McDermott @@ -29,8 +30,8 @@ Written by P. J. McDermott.' oh_str_bad_opt='Invalid option "%s"' # opkbuild strings: -oh_str_help_opkbuild='Usage: opkbuild [