From a2d9a26f4cd7b4076c6be4a370f3c382a785e0c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luc=C3=ADa=20Andrea=20Illanes=20Albornoz?= Date: Wed, 22 Feb 2023 04:47:23 +0100 Subject: subr.ex/ex_init.subr:ex_init_help(): show short usage information given -h. --- subr.ex/ex_init.subr | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'subr.ex') diff --git a/subr.ex/ex_init.subr b/subr.ex/ex_init.subr index 13e0edd3..e15efda8 100644 --- a/subr.ex/ex_init.subr +++ b/subr.ex/ex_init.subr @@ -178,7 +178,16 @@ ex_init_help() { while [ "${#}" -gt 0 ]; do case "${1}" in - -h|--help) + -h) + if [ -t 1 ]; then + cat "etc/${_eih_name_base}.usage.short"; + else + sed 's/\[[0-9]\+m//g' "etc/${_eih_name_base}.usage.short"; + fi; + exit 0; + ;; + + --help) if [ -t 1 ]; then cat "etc/${_eih_name_base}.usage"; else @@ -206,9 +215,9 @@ ex_init_help() { case "${_eih_opt}" in h) if [ -t 1 ]; then - cat "etc/${_eih_name_base}.usage"; + cat "etc/${_eih_name_base}.usage.short"; else - sed 's/\[[0-9]\+m//g' "etc/${_eih_name_base}.usage"; + sed 's/\[[0-9]\+m//g' "etc/${_eih_name_base}.usage.short"; fi; exit 0; ;; -- cgit v1.2.3