Update the Bash example with the multi source files option
* Usage of $easyoptions_include in bash/example.sh * The example sourced scripts bash/some_sourced_lib.sh and bash/that_other_lib.sh
This commit is contained in:
parent
728fa33f94
commit
fcbed984d8
|
@ -21,8 +21,9 @@
|
|||
## format.
|
||||
|
||||
script_dir=$(dirname "$BASH_SOURCE")
|
||||
source "${script_dir}/../easyoptions" || exit # Ruby implementation
|
||||
# source "${script_dir}/easyoptions.sh" || exit # Bash implementation, slower
|
||||
easyoptions_include="${script_dir}/some_sourced_lib.sh ${script_dir}/that_other_lib.sh"
|
||||
# source "${script_dir}/../easyoptions" || exit # Ruby implementation
|
||||
source "${script_dir}/easyoptions.sh" || exit # Bash implementation, slower
|
||||
|
||||
# Boolean and parameter options
|
||||
[[ -n "$some_option" ]] && echo "Option specified: --some-option"
|
||||
|
@ -33,3 +34,9 @@
|
|||
for argument in "${arguments[@]}"; do
|
||||
echo "Argument specified: $argument"
|
||||
done
|
||||
|
||||
source "${script_dir}/some_sourced_lib.sh"
|
||||
some-lib-feature
|
||||
|
||||
source "${script_dir}/that_other_lib.sh"
|
||||
that-other-feature
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
## -s, --some-lib-option This is an additional option.
|
||||
some-lib-feature()
|
||||
{
|
||||
[[ -n "$some_lib_option" ]] && echo "Some lib option: $some_lib_option"
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
## -t, --that-option That is the option.
|
||||
that-other-feature()
|
||||
{
|
||||
[[ -n "$that_option" ]] && echo "That other option: $that_option"
|
||||
}
|
||||
|
Loading…
Reference in New Issue