Commit 9a24c366 authored by Emeric Verschuur's avatar Emeric Verschuur

update the help display

parent de2c518f
......@@ -96,7 +96,7 @@ bashopts_process_args
## Example
```bash
#!/bin/bash -e
#!/bin/bash -ei
# load the library
. bashopts.sh
......
......@@ -266,6 +266,10 @@ bashopts_math_max() {
echo $(($1>$2?$1:$2))
}
bashopts_math_min() {
echo $(($1<$2?$1:$2))
}
bashopts_join_by() {
local IFS="$1"
shift
......@@ -304,7 +308,7 @@ bashopts_dump_value() {
}
bashopts_diplay_help() {
local elts optargs_max_len=8 val dval
local elts optargs_max_len=8 val dval ncol=$COLUMNS
declare -A optargs
for op in "${bashopts_optlist[@]}"; do
elts=()
......@@ -317,6 +321,9 @@ bashopts_diplay_help() {
optargs[$op]="$(bashopts_join_by , ${elts[@]})$val"
optargs_max_len=$(bashopts_math_max $optargs_max_len ${#optargs[$op]})
done
ncol=${ncol:-160}
optargs_max_len=$(bashopts_math_min $optargs_max_len $(( $ncol / 3 )) )
set +x
echo
echo "NAME:"
echo " $bashopts_tool_name - $bashopts_tool_description"
......
#!/bin/bash -e
#!/bin/bash -ei
# load the library
. bashopts.sh
......
#!/bin/bash -e
#!/bin/bash -ei
# Copyright 2017 Emeric Verschuur <emeric@mbedsys.org>
#
# Licensed to the Apache Software Foundation (ASF) under one
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment