Skip to content

Commit c533b45

Browse files
committed
Support '--workspace <WORKSPACE_DIR>'
The current entrypoint fails if the user uses --workspace /my/workspace with a space instead of an equals. This change supports that format as well as the SIYUAN_WORKSPACE_PATH env variable. SIYUAN_WORKSPACE_PATH=/should/be/ignored ./stuff.sh --workspace /my/workspace --workspace-prefix --fla g-equal=3 --flag-no-equal 4 WORKSPACE_DIR: /my/workspace ARGS: --workspace-prefix --flag-equal=3 --flag-no-equal 4 SIYUAN_WORKSPACE_PATH=/my/workspace ./stuff.sh --w orkspace-prefix --flag-equal=3 --flag-no-equal 4 WORKSPACE_DIR: /siyuan/workspace ARGS: --workspace-prefix --flag-equal=3 --flag-no-equal 4
1 parent b737202 commit c533b45

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

kernel/entrypoint.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,16 @@ else
2828
adduser --uid "${PUID}" --ingroup "${group_name}" --disabled-password --gecos "" "${user_name}"
2929
fi
3030

31-
# Parse command line arguments for --workspace option
31+
# Parse command line arguments for --workspace option or SIYUAN_WORKSPACE_PATH env variable
3232
# Store other arguments in ARGS for later use
33+
if [[ -v "${SIYUAN_WORKSPACE_PATH}" ]]; then
34+
WORKSPACE_DIR="${SIYUAN_WORKSPACE_PATH}"
35+
fi
3336
ARGS=""
3437
while [[ "$#" -gt 0 ]]; do
3538
case $1 in
3639
--workspace=*) WORKSPACE_DIR="${1#*=}"; shift ;;
40+
--workspace) WORKSPACE_DIR="${2}"; shift; shift ;;
3741
*) ARGS="$ARGS $1"; shift ;;
3842
esac
3943
done

0 commit comments

Comments
 (0)