improvement: Improve help text in start_docker.sh

This commit is contained in:
John Colvin committed 2023-03-26 13:43:56 -04:00
1 parent 71084aac23
commit a91f31d1f6
1 file changed
+12 -8
+12 -8
View File
@@ -1,5 +1,7 @@
#!/usr/bin/env bash
mount_prefix="$HOME/.spark-dev/mounts"
function print_help_and_exit() {
cat <<EOF
Start a docker dev container
@@ -10,13 +12,15 @@ Positionals:
container The name for the container
Options:
-u,--user The user (name) to add to the image (defaults to the current user)
-p,--pass The password for the <--user> in the image (defaults to <--user>)
-i,--image The image to instantiate
-c,--container The name for the container
-m,--mount The name for the folder (on the host) that is mounted to container's 'home' dir
--port <docker_port>:<host_port> or [<docker_port>:<host_port>,...] Port mapping(s). May be specified multiple times.
-h,--help Print this help message and exit
-u,--user USER The user to add in the container (defaults to the current user)
-p,--pass PASS The password for USER in the container (defaults to USER)
-i,--image IMAGE The image to instantiate
-c,--container CONT The name for the container
-m,--mount MOUNT The name for the folder (outside the container) to create/mount to the home
directory in the container. Mount folders are added here: $mount_prefix
--port <cont_port>:<host_port> OR [<cont_port>:<host_port>,...] Port mapping(s). May be
specified multiple times.
-h,--help Print this help message and exit
EOF
exit "$1"
@@ -143,7 +147,7 @@ if [[ -z "$docker_user" ]]; then
docker_user="$USER"
fi
home_src=$HOME/.spark-dev/mounts/$mount_name
home_src=$mount_prefix/$mount_name
home_tgt=$HOME
repo_src=$(git rev-parse --show-superproject-working-tree)
repo_tgt=$HOME/$(basename "$repo_src")