Skip to content

Commit 94ad2d2

Browse files
committed
improve structurizr lite script to allow referencing md files in entire repo
1 parent 46764e0 commit 94ad2d2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

docs/structurizr.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,20 @@
33
## start Structurizr Lite with the given workspace file, relative to the current working directory. Omit the file extension.
44
## Optional second argument of a port number to use. Default is 8085.
55

6+
SCRIPT_PATH=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
7+
SCRIPT_DIR=$(basename "$SCRIPT_PATH")
8+
PROJ_DIR=$(dirname "$SCRIPT_PATH")
9+
10+
echo $SCRIPT_PATH
11+
echo $PROJ_DIR
12+
613
echo "hosting on http://localhost:${PORT:=${2:-8085}}"
714
# Check if the workspace file exists
8-
if [ ! -f "$1.dsl" ]; then
9-
echo "Workspace file $1 does not exist."
15+
if [ ! -f "$SCRIPT_PATH/$1.dsl" ]; then
16+
echo "Workspace file $1.dsl does not exist in $SCRIPT_PATH."
1017
exit 1
1118
fi
1219

13-
docker run -it --rm -p $PORT:8080 -v $(pwd):/usr/local/structurizr -e STRUCTURIZR_WORKSPACE_FILENAME=$1 structurizr/lite
20+
echo "Loading workspace file: $SCRIPT_PATH/$1.dsl"
21+
22+
docker run -it --rm -p $PORT:8080 -v $PROJ_DIR:/usr/local/structurizr -e STRUCTURIZR_WORKSPACE_FILENAME=$SCRIPT_DIR/$1 structurizr/lite

0 commit comments

Comments
 (0)