Skip to content

Commit 4f76962

Browse files
committed
in the case of no arg, run all
1 parent 3c46860 commit 4f76962

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

photonlib-python-examples/run.bat

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
@echo off
22
setlocal
33

4-
:: Check if the first argument is provided
5-
if "%~1"=="" (
6-
echo Error: No example-to-run provided.
7-
exit /b 1
8-
)
9-
104
:: To run any example, we want to use photonlib out of the source code in this repo.
115
:: Build the wheel first
126
pushd %~dp0..\photon-lib\py
@@ -18,6 +12,18 @@ popd
1812
set PHOTONLIBPY_ROOT=%~dp0..\photon-lib\py
1913
set PYTHONPATH=%PHOTONLIBPY_ROOT%
2014

15+
:: If an example to run is not provided, run all examples
16+
if "%~1"=="" (
17+
echo No example provided, running all examples
18+
for /D %%d in (*) do (
19+
if (not "%%d"=="." if not "%%d"=="..") (
20+
echo Running example in %%d
21+
call "%~dp0run.bat" "%%d"
22+
)
23+
)
24+
exit /b 0
25+
)
26+
2127
:: Move to to the right example folder
2228
cd %~1
2329

photonlib-python-examples/run.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
# Check if the first argument is provided
2-
if [ $# -eq 0 ]
3-
then
4-
echo "Error: No example-to-run provided."
5-
exit 1
6-
fi
7-
81
# To run any example, we want to use photonlib out of this repo
92
# Build the wheel first
103
pushd ../photon-lib/py
@@ -18,6 +11,18 @@ popd
1811
export PHOTONLIBPY_ROOT=../photon-lib/py
1912
export PYTHONPATH=$PHOTONLIBPY_ROOT
2013

14+
# If an example to run is not provided, run all examples
15+
if [ $# -eq 0 ]
16+
then
17+
echo "No example provided, running all examples"
18+
for dir in */
19+
do
20+
echo "Running example in $dir"
21+
./run.sh $dir
22+
done
23+
exit 0
24+
fi
25+
2126
# Move to the right example folder
2227
cd $1
2328

0 commit comments

Comments
 (0)