Skip to content

Commit

Permalink
Handle multiple options in configure #33
Browse files Browse the repository at this point in the history
Signed-off-by: Jono Yang <[email protected]>
  • Loading branch information
JonoYang committed Sep 3, 2021
1 parent 45e4a2a commit a95bd4b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
18 changes: 12 additions & 6 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,18 @@ CFG_DEV_MODE=0
CFG_REQUIREMENTS=$REQUIREMENTS
NO_INDEX="--no-index"

case "$CLI_ARGS" in
--help) cli_help;;
--clean) clean;;
--dev) CFG_REQUIREMENTS="$DEV_REQUIREMENTS" && CFG_DEV_MODE=1;;
--init) NO_INDEX="";;
esac
# We are using getopts to parse option arguments that start with "-"
while getopts :-: optchar; do
case "${optchar}" in
-)
case "${OPTARG}" in
help ) cli_help;;
clean ) clean;;
dev ) CFG_REQUIREMENTS="$DEV_REQUIREMENTS" && CFG_DEV_MODE=1;;
init ) NO_INDEX="";;
esac;;
esac
done

PIP_EXTRA_ARGS="$PIP_EXTRA_ARGS $NO_INDEX"

Expand Down
31 changes: 18 additions & 13 deletions configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,24 @@ set CFG_DEV_MODE=0
set "CFG_REQUIREMENTS=%REQUIREMENTS%"
set "NO_INDEX=--no-index"

if "%1" EQU "--help" (goto cli_help)
if "%1" EQU "--clean" (goto clean)
if "%1" EQU "--dev" (
set "CFG_REQUIREMENTS=%DEV_REQUIREMENTS%"
set CFG_DEV_MODE=1
)
if "%1" EQU "--init" (
set "NO_INDEX= "
)
if "%1" EQU "--python" (
echo "The --python option is now DEPRECATED. Use the PYTHON_EXECUTABLE environment"
echo "variable instead. Run configure --help for details."
exit /b 0
:again
if not "%1" == "" (
if "%1" EQU "--help" (goto cli_help)
if "%1" EQU "--clean" (goto clean)
if "%1" EQU "--dev" (
set "CFG_REQUIREMENTS=%DEV_REQUIREMENTS%"
set CFG_DEV_MODE=1
)
if "%1" EQU "--init" (
set "NO_INDEX= "
)
if "%1" EQU "--python" (
echo "The --python option is now DEPRECATED. Use the PYTHON_EXECUTABLE environment"
echo "variable instead. Run configure --help for details."
exit /b 0
)
shift
goto again
)

set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS% %NO_INDEX%"
Expand Down

0 comments on commit a95bd4b

Please sign in to comment.