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

update the help display

parent de2c518f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ bashopts_process_args
## Example

```bash
#!/bin/bash -e
#!/bin/bash -ei

# load the library
. bashopts.sh
+8 −1
Original line number Diff line number Diff line
@@ -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"
+1 −1
Original line number Diff line number Diff line
#!/bin/bash -e
#!/bin/bash -ei

# load the library
. bashopts.sh
+1 −1
Original line number Diff line number Diff line
#!/bin/bash -e
#!/bin/bash -ei
# Copyright 2017 Emeric Verschuur <emeric@mbedsys.org>
#
# Licensed to the Apache Software Foundation (ASF) under one