Skip to content

Commit 6ef053d

Browse files
create verbose mode for build_parents_file.sh script, defaults to false
Signed-off-by: Michael Valdron <mvaldron@redhat.com>
1 parent 3b38651 commit 6ef053d

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

tests/build_parents_file.sh

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
#!/bin/bash
22

3+
POSITIONAL_ARGS=()
4+
VERBOSE="false"
5+
6+
while [[ $# -gt 0 ]]; do
7+
case $1 in
8+
-v|--verbose)
9+
VERBOSE="true"
10+
shift # past argument
11+
;;
12+
-*|--*)
13+
echo "Unknown option $1"
14+
exit 1
15+
;;
16+
*)
17+
POSITIONAL_ARGS+=("$1") # save positional arg
18+
shift # past argument
19+
;;
20+
esac
21+
done
22+
23+
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
24+
325
# default samples file path
426
samples_file=$(pwd)/extraDevfileEntries.yaml
527
# Cached remote samples directory
@@ -205,10 +227,20 @@ get_children_of_parents() {
205227

206228
if [ ! -d ${base_path}/registry-support ]
207229
then
208-
git clone https://github.com/devfile/registry-support ${base_path}/registry-support
230+
if [ "$VERBOSE" == "true" ]
231+
then
232+
git clone https://github.com/devfile/registry-support ${base_path}/registry-support
233+
else
234+
git clone -q https://github.com/devfile/registry-support ${base_path}/registry-support
235+
fi
209236
fi
210237

211-
bash ${base_path}/registry-support/build-tools/cache_samples.sh ${samples_file} ${samples_dir}
238+
if [ "$VERBOSE" == "true" ]
239+
then
240+
bash ${base_path}/registry-support/build-tools/cache_samples.sh ${samples_file} ${samples_dir}
241+
else
242+
bash ${base_path}/registry-support/build-tools/cache_samples.sh ${samples_file} ${samples_dir} > /dev/null 2>&- echo
243+
fi
212244

213245
if [ -f ${parents_file} ]; then
214246
rm ${parents_file}

0 commit comments

Comments
 (0)