summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/shman.sh23
1 files changed, 22 insertions, 1 deletions
diff --git a/tools/shman.sh b/tools/shman.sh
index ea4ff7f..5cf9aab 100644
--- a/tools/shman.sh
+++ b/tools/shman.sh
@@ -76,6 +76,11 @@ gen_doc_func()
local args=
local sect_name=
local sect_desc=
+ local opt=
+ local optarg=
+ local desc=
+ local first_opt=true
+ local sect_opts=
local sect_ret=
sect_name=".SH NAME${LF}${sym}"
@@ -87,6 +92,22 @@ gen_doc_func()
'details')
sect_desc=".SH DESCRIPTION${LF}${args}"
;;
+ 'option')
+ read opt optarg desc <<-EOF
+ ${args}
+ EOF
+ if ${first_opt}; then
+ sect_opts=".SH OPTIONS${LF}"
+ fi
+ first_opt=false
+ if [ "x${optarg}" = 'x-' ]; then
+ opt=".B ${opt}"
+ else
+ opt=".BI ${opt} \\ ${optarg}"
+ fi
+ sect_opts="${sect_opts}.TP${LF}${opt}${LF}"
+ sect_opts="${sect_opts}${desc}${LF}"
+ ;;
'return')
sect_ret=".SH RETURN VALUE${LF}${args}"
;;
@@ -95,7 +116,7 @@ gen_doc_func()
${doc}
EOF
- printf '%s\n\n' "${sect_name}" "${sect_desc}" "${sect_ret}"
+ printf '%s\n\n' "${sect_name}" "${sect_desc}" "${sect_opts}" "${sect_ret}"
}
gen_doc()