summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/messages.sh12
-rw-r--r--locale/en_US.sh6
-rw-r--r--src/oh-unpacksource.sh5
-rw-r--r--src/opkbuild.sh5
4 files changed, 25 insertions, 3 deletions
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 <http://www.gnu.org/licenses/>.
# 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 [<option>...]
-
+oh_str_usage_opkbuild='Usage: opkbuild [<option>...]'
+oh_str_help_opkbuild='
Options:
-b build only binary packages
-B build only architecture-dependent binary packages
@@ -74,6 +75,7 @@ oh_str_cant_apply_patch='Can'\''t apply patch "%s"'
oh_str_no_patches='No patches to be applied'
# oh-unpacksource strings:
+oh_str_usage_oh_unpacksource='Usage: oh-unpacksource'
oh_str_unpacking_native='Copying native source directory...'
oh_str_cant_unpack_native='Can'\''t copy native source directory'
oh_str_no_sources='No native or upstream sources found'
diff --git a/src/oh-unpacksource.sh b/src/oh-unpacksource.sh
index 128d85a..eb48aed 100644
--- a/src/oh-unpacksource.sh
+++ b/src/oh-unpacksource.sh
@@ -32,6 +32,11 @@ main()
{
oh_locale_set
+ if [ "${#}" -ne 0 ]; then
+ oh_usage
+ exit 1
+ fi
+
if [ -d ../src ]; then
unpack_native
else
diff --git a/src/opkbuild.sh b/src/opkbuild.sh
index 94bc6c7..7fdd33d 100644
--- a/src/opkbuild.sh
+++ b/src/opkbuild.sh
@@ -77,6 +77,10 @@ main()
oh_locale_set
get_options
+ if [ "${#}" -ne 0 ]; then
+ oh_usage
+ exit 1
+ fi
test_uid0_cmd
@@ -172,6 +176,7 @@ get_options()
;;
esac
done
+ shift $(($OPTIND - 1))
# Set default option values.
[ -z "${OPT_BUILD}" ] && OPT_BUILD=full