diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2018-12-27 01:17:14 (EST) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2018-12-27 01:17:14 (EST) |
commit | 79c7a57807289cdffc30132012f37b59fed54945 (patch) | |
tree | d2354173a0ab924b8ff51dc9335bfc5c11db8c83 /tools | |
parent | d4352844aa8729d29edaefe3d69ba2bdc4be9aeb (diff) |
tools/shman.sh: Generate "OPTIONS" sections
Diffstat (limited to 'tools')
-rw-r--r-- | tools/shman.sh | 23 |
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() |