Skip to content

Commit 9f24a7f

Browse files
committed
feat: added -y option
1 parent a53db99 commit 9f24a7f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

conda/install.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,23 @@ fi
2323

2424

2525
usage(){
26-
echo "Usage: install.sh [-h]"
26+
echo "Usage: install.sh [-h] [-y]"
2727
echo
2828
echo "-h : show this help"
29+
echo "-y : Adds '-y' option to '$CONDA env [create|remove|...]' command arguments."
2930
exit 1
3031
}
3132

32-
while getopts "h" OPTNAME ; do
33+
CONDA_OPTIONS=""
34+
while getopts "yh" OPTNAME ; do
3335
case "${OPTNAME}" in
3436
h)
3537
usage
3638
;;
39+
y)
40+
CONDA_OPTIONS="-y"
41+
shift 1
42+
;;
3743
:)
3844
# If expected argument omitted:
3945
echo "Error: -${OPTARG} requires an argument."
@@ -50,15 +56,15 @@ done
5056
if $CONDA env list | grep -q mellea
5157
then
5258
echo "An existing mellea environment was found."
53-
$CONDA env remove -n mellea
59+
$CONDA env remove $CONDA_OPTIONS -n mellea
5460
fi
5561

5662

5763
# note:
5864
# this is a portable way (works in linux and osx) to get the directory of this script.
5965
# readlink -ef may not work on osx.
6066
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
61-
$CONDA env create -f $SCRIPT_DIR/environment.yml
67+
$CONDA env create $CONDA_OPTIONS -f $SCRIPT_DIR/environment.yml
6268

6369
$CONDA run -n mellea uv pip install -e .[all] --group dev --group notebook --group docs
6470

0 commit comments

Comments
 (0)