diff --git a/bash/example.sh b/bash/example.sh index 0700d24..6d39e6d 100644 --- a/bash/example.sh +++ b/bash/example.sh @@ -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 diff --git a/bash/some_sourced_lib.sh b/bash/some_sourced_lib.sh new file mode 100644 index 0000000..ac331c3 --- /dev/null +++ b/bash/some_sourced_lib.sh @@ -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" +} diff --git a/bash/that_other_lib.sh b/bash/that_other_lib.sh new file mode 100644 index 0000000..79f6a76 --- /dev/null +++ b/bash/that_other_lib.sh @@ -0,0 +1,6 @@ +## -t, --that-option That is the option. +that-other-feature() +{ + [[ -n "$that_option" ]] && echo "That other option: $that_option" +} +