feat: improved dev env launcher script
This commit is contained in:
+27
-9
@@ -3,20 +3,38 @@
|
|||||||
base_path="~/projects/system/dev-env/scripts/"
|
base_path="~/projects/system/dev-env/scripts/"
|
||||||
mount_path=$(pwd)
|
mount_path=$(pwd)
|
||||||
if [[ -n "$2" ]]; then
|
if [[ -n "$2" ]]; then
|
||||||
name=$2
|
name=$2
|
||||||
else
|
else
|
||||||
name=$(pwd | rev | cut -d "/" -f 1 | rev)
|
name=$(pwd | rev | cut -d "/" -f 1 | rev)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "
|
if [[ $1 == "rm" ]]; then
|
||||||
|
echo "
|
||||||
|
janishutz dev containers
|
||||||
|
|
||||||
|
-> Removing container $name <-
|
||||||
|
"
|
||||||
|
docker stop $name
|
||||||
|
docker container rm $name
|
||||||
|
elif [[ $1 == "help" ]]; then
|
||||||
|
echo "
|
||||||
|
dev-containers [container|rm|help] [name]
|
||||||
|
|
||||||
|
Container can be one of:
|
||||||
|
- base
|
||||||
|
- node
|
||||||
|
- php
|
||||||
|
- python
|
||||||
|
- torch-rocm
|
||||||
|
- vue
|
||||||
|
- webserver
|
||||||
|
rm removes the container for the current directory if provided name is equal, or unspecified.
|
||||||
|
"
|
||||||
|
else
|
||||||
|
echo "
|
||||||
janishutz dev containers
|
janishutz dev containers
|
||||||
|
|
||||||
-> Creating container $name <-
|
-> Creating container $name <-
|
||||||
"
|
"
|
||||||
|
eval "${base_path}/$1-container $name $mount_path"
|
||||||
if $1 == "rm"; then
|
|
||||||
docker stop $name
|
|
||||||
docker container rm $name
|
|
||||||
else
|
|
||||||
eval "${base_path}/$1-container $name $mount_path"
|
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
complete -a "base node php python torch-rocm vue webserver" -c dev-containers -f
|
complete -a "base node php python torch-rocm vue webserver" -c dev-containers -f
|
||||||
complete -a "rm" -d "Delete the container for this folder" -c dev-containers -f
|
complete -a "rm" -d "Delete the container for this folder" -c dev-containers -f
|
||||||
|
complete -a "help" -d "Show help" -c dev-containers -f
|
||||||
|
|||||||
Reference in New Issue
Block a user