Skip to content

Commit 0aa6d72

Browse files
committed
Support for opts
1 parent 1af66de commit 0aa6d72

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

hooks/command

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function plugin_read_list() {
2121

2222
IFS=$'\n\t'
2323
files=()
24+
options=()
2425

2526
# Evaluate all the globs and return the files that exist
2627
for file in $(plugin_read_list FILES) ; do
@@ -29,13 +30,18 @@ for file in $(plugin_read_list FILES) ; do
2930
fi
3031
done
3132

33+
# Read in the options to pass to shellcheck
34+
for option in $(plugin_read_list OPTIONS) ; do
35+
options+=("$option")
36+
done
37+
3238
if [[ -z ${files:-} ]] ; then
3339
echo "No files found to shellcheck"
3440
exit 1
3541
fi
3642

3743
echo "+++ Running shellcheck on ${#files[@]} files"
38-
if docker run --rm -v "$PWD:/mnt" --workdir "/mnt" koalaman/shellcheck "${files[@]}" ; then
44+
if docker run --rm -v "$PWD:/mnt" --workdir "/mnt" koalaman/shellcheck "${options[@]}" "${files[@]}" ; then
3945
echo "Files are ok ✅"
4046
else
4147
exit 1

plugin.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ configuration:
99
files:
1010
type: [string, array]
1111
minItems: 1
12+
options:
13+
type: [string, array]
14+
minItems: 1
1215
required:
1316
- files

0 commit comments

Comments
 (0)