Skip to content

Commit 16948c9

Browse files
committed
sketch_utils.sh: Make the target argument optional.
This will allow using the function to count all sketches present in a directory. Signed-off-by: Abdelatif Guettouche <[email protected]>
1 parent b441b9c commit 16948c9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: .github/scripts/sketch_utils.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <fqbn> <path-to-i
3232
$win_opts $xtra_opts "$sketch"
3333
}
3434

35-
function count_sketches(){ # count_sketches <path> <target>
35+
function count_sketches(){ # count_sketches <path> [target]
3636
local path=$1
3737
local target=$2
3838

39-
if [ $# -lt 2 ]; then
39+
if [ $# -lt 1 ]; then
4040
echo "ERROR: Illegal number of parameters"
41-
echo "USAGE: ${0} count <path> <target>"
41+
echo "USAGE: ${0} count <path> [target]"
4242
fi
4343

4444
rm -rf sketches.txt
@@ -55,7 +55,7 @@ function count_sketches(){ # count_sketches <path> <target>
5555
local sketchname=$(basename $sketch)
5656
if [[ "$sketchdirname.ino" != "$sketchname" ]]; then
5757
continue
58-
elif [[ -f "$sketchdir/.skip.$target" ]]; then
58+
elif [[ -n $target ]] && [[ -f "$sketchdir/.skip.$target" ]]; then
5959
continue
6060
else
6161
echo $sketch >> sketches.txt

0 commit comments

Comments
 (0)