Lukas Stockner 95b9cb1469 Add support for repeatable arguments (#118)
* Add support for declaring arguments as repeatable

If the usage of the argument includes the phrase "Can be repeated.",
the corresponding arg_ variable will be an array containing one element
per instance of the argument.

* Add example and test for using repeated parameters

* Add example and test for using repeated flags
2019-09-20 11:40:06 +02:00

20 lines
574 B
Bash

#!/usr/bin/env bash
# set -o pipefail
# set -o errexit
set -o nounset
# set -o xtrace
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__root="$(cd "$(dirname "$(dirname "$(dirname "${__dir}")")")" && pwd)"
echo "ACCPTST:STDIO_REPLACE_DATETIMES"
(
env LOG_LEVEL=6 bash "${__root}/main.sh" -f dummy -i simple_input -i "input_in_quotes" -i "input with spaces" -i "input with \"quotes\"" -i last_input
) 2>&1 |grep arg_i -A 5
(
env LOG_LEVEL=6 bash "${__root}/main.sh" -x -f dummy -x -x
env LOG_LEVEL=6 bash "${__root}/main.sh" -f dummy -xxxx
) 2>&1 |grep arg_x