diff --git a/devbox/devbox.local/devbox b/devbox/devbox.local/devbox index c6d2c84..e320d5d 100644 --- a/devbox/devbox.local/devbox +++ b/devbox/devbox.local/devbox @@ -51,445 +51,187 @@ get_arg() { # :command.usage devbox_usage() { - printf "devbox - DevBox Command Line Tool\n\n" + printf "Command\n" + printf " devbox : DevBox Command Line Tool for managing the local development environment.\n\n" - printf "%s\n" "Usage:" - printf " devbox COMMAND\n" - printf " devbox [COMMAND] --help | -h\n" - printf " devbox --version | -v\n" + printf "Arguments\n" + printf " COMMAND [Required] : Specify the command to execute (e.g., init, deinit, start, stop, status, restart).\n\n" + + printf "Global Arguments\n" + printf " --help, -h : Show this help message and exit.\n" + printf " --version, -v : Show version number.\n\n" + + printf "Examples\n" + printf " Display help for the 'init' command:\n" + printf " devbox init --help\n\n" + printf " Display version information:\n" + printf " devbox --version\n" echo - # :command.usage_commands - printf "%s\n" "Commands:" - printf " %s Initialize the local development environment based on DevBox container.\n" "init" - echo - - # :command.long_usage - if [[ -n "$long_usage" ]]; then - printf "%s\n" "Options:" - - # :command.usage_fixed_flags - printf " %s\n" "--help, -h" - printf " Show this help\n" - echo - printf " %s\n" "--version, -v" - printf " Show version number\n" - echo - - # :command.usage_environment_variables - printf "%s\n" "Environment Variables:" - - # :environment_variable.usage - printf " %s\n" "FREELEAPS_USERNAME" - printf " Set the Freeleaps username for cloning the source repository.\n" - echo - - # :environment_variable.usage - printf " %s\n" "FREELEAPS_PASSWORD" - printf " Set the Freeleaps password for cloning the source repository.\n" - echo - - # :environment_variable.usage - printf " %s\n" "WORKING_HOME" - printf " Set the working home directory for DevBox.\n" - echo - - fi } # :command.usage devbox_init_usage() { if [[ -n $long_usage ]]; then - printf "devbox init\n\n" - printf " Initialize the local development environment based on DevBox container.\n This command will pull the DevBox container image, create containers for \n various Freeleaps components, clone the source code repository, and \n persist relevant container/process information under WORKING_HOME.\n \n Sub-command \`init\` uses Docker (or another container runtime) to set \n up a local DevBox environment for Freeleaps development. \n It follows these major steps:\n 1. Validate flags and environment.\n 2. Pull DevBox base image and create container.\n 3. Pull each required component image, create containers.\n 4. Clone remote source repository using FREELEAPS_USERNAME/PASSWORD.\n 5. Start back-end and front-end services.\n 6. Persist container IDs, logs, etc. into WORKING_HOME.\n\n" + printf "Command\n" + printf " devbox init : Initialize the local development environment based on DevBox container.\n\n" + + printf "Arguments\n" + printf " --os -o [Optional] : Specifies the operating system. Default: auto.\n" + printf " --arch -a [Optional] : Specifies the architecture. Default: auto.\n" + printf " --working-home -w [Optional] : Specifies the working home of DevBox CLI. Default: %s/.devbox\n" "$HOME" + printf " --devbox-container-name -N [Optional] : Specifies the DevBox container name. Default: devbox.\n" + printf " --devbox-container-port -P [Optional] : Specifies the container port for DevBox SSH access. Default: 22222.\n" + printf " --devbox-image-repo -R [Optional] : Specifies the DevBox container image repository. Default: docker.io/freeleaps.\n" + printf " --devbox-image-name -I [Optional] : Specifies the DevBox container image name. Default: devbox.\n" + printf " --devbox-image-tag -T [Optional] : Specifies the DevBox container image tag. Default: latest.\n" + printf " --devbox-frontend-port -F [Optional] : Specifies the container port for DevBox frontend access. Default: 5173.\n" + printf " --devbox-backend-port -B [Optional] : Specifies the container port for DevBox backend access. Default: 8002.\n" + printf " --freeleaps-username -U [Optional] : Specifies the Freeleaps.com repository username.\n" + printf " --freeleaps-password -X [Optional] : Specifies the Freeleaps.com repository password.\n" + printf " --use-local-component -u [Optional] : Check if using local component or online dev environment. Default: false.\n" + printf " --devsvc-image-repo -D [Optional] : Specifies the repository for devsvc component.\n" + printf " --devsvc-image-name -M [Optional] : Specifies the image name for devsvc component.\n" + printf " --devsvc-image-tag -G [Optional] : Specifies the image tag for devsvc component. Default: latest.\n" + printf " --notification-image-repo -Y [Optional] : Specifies the repository for notification component.\n" + printf " --notification-image-name -K [Optional] : Specifies the image name for notification component.\n" + printf " --notification-image-tag -Z [Optional] : Specifies the image tag for notification component. Default: latest.\n" + printf " --content-image-repo -C [Optional] : Specifies the repository for content component.\n" + printf " --content-image-name -E [Optional] : Specifies the image name for content component.\n" + printf " --content-image-tag -H [Optional] : Specifies the image tag for content component. Default: latest.\n" + printf " --central_storage-image-repo -S [Optional] : Specifies the repository for central_storage component.\n" + printf " --central_storage-image-name -J [Optional] : Specifies the image name for central_storage component.\n" + printf " --central_storage-image-tag -Q [Optional] : Specifies the image tag for central_storage component. Default: latest.\n" + printf " --authentication-image-repo -V [Optional] : Specifies the repository for authentication component.\n" + printf " --authentication-image-name -L [Optional] : Specifies the image name for authentication component.\n" + printf " --authentication-image-tag -W [Optional] : Specifies the image tag for authentication component. Default: latest.\n" + printf " --force -f [Optional] : Force initialization even if resources already exist.\n\n" + + printf "Global Arguments\n" + printf " --help -h : Show this help message and exit.\n\n" + + printf "Examples\n" + printf " Initialize DevBox with Linux OS and ARM64 architecture:\n" + printf " devbox init --os linux --arch arm64 --freeleaps-username alice --freeleaps-password secret\n" + printf " Initialize with custom container settings:\n" + printf " devbox init --devbox-container-name custom-devbox --devbox-container-port 22222 --freeleaps-username alice --freeleaps-password secret\n" else printf "devbox init - Initialize the local development environment based on DevBox container.\n\n" fi - printf "Alias: i\n" - echo - - printf "%s\n" "Usage:" - printf " devbox init [OPTIONS]\n" - printf " devbox init --help | -h\n" - echo - - # :command.long_usage - if [[ -n "$long_usage" ]]; then - printf "%s\n" "Options:" - - # :command.usage_flags - # :flag.usage os (auto, linux, darwin, wsl2) - printf " %s\n" "--os OS" - printf " Specifies the operating system (auto, linux, darwin, wsl2). Default is auto.\n" - printf " %s\n" "Default: auto" - echo - - # :flag.usage arch - printf " %s\n" "--arch ARCH" - printf " Specifies the architecture (auto, amd64, arm64). Default is auto.\n" - printf " %s\n" "Default: auto" - echo - - # :flag.usage devbox container name - printf " %s\n" "--devbox-container-name DEVBOX_CONTAINER_NAME" - printf " Specifies the DevBox container name. Default is devbox.\n" - printf " %s\n" "Default: devbox" - echo - - # :flag.usage devbox container port - printf " %s\n" "--devbox-container-port DEVBOX_CONTAINER_PORT" - printf " Specifies the container port for DevBox SSH access. Default is 22222.\n" - printf " %s\n" "Default: 22222" - echo - - # :flag.usage devbox image repo - printf " %s\n" "--devbox-image-repo DEVBOX_IMAGE_REPO" - printf " Specifies the DevBox container image repository. Default is\n docker.io/freeleaps.\n" - printf " %s\n" "Default: docker.io/freeleaps" - echo - - # :flag.usage devbox frontend port - printf " %s\n" "--devbox-frontend-port DEVBOX_FRONTEND_PORT" - printf " Specifies the container port for DevBox frontend access. Default is 5173.\n" - printf " %s\n" "Default: 5173" - echo - - # :flag.usage devbox backend port - printf " %s\n" "--devbox-backend-port DEVBOX_BACKEND_PORT" - printf " Specifies the container port for DevBox backend access. Default is 8002.\n" - printf " %s\n" "Default: 8002" - echo - - # :flag.usage devbox image name - printf " %s\n" "--devbox-image-name DEVBOX_IMAGE_NAME" - printf " Specifies the DevBox container image name. Default is devbox.\n" - printf " %s\n" "Default: devbox" - echo - - # :flag.usage devbox image tag - printf " %s\n" "--devbox-image-tag DEVBOX_IMAGE_TAG" - printf " Specifies the DevBox container image tag. Default is latest.\n" - printf " %s\n" "Default: latest" - echo - - # :flag.usage working home - printf " %s\n" "--working-home WORKING_HOME" - printf " Specifies the working home of DevBox CLI. Default is ${HOME}/.devbox.\n" - echo - - # :flag.usage freeleaps username - printf " %s\n" "--freeleaps-username FREELEAPS_USERNAME (optional)" - printf " Specifies the Freeleaps.com repository username (Optional).\n" - echo - - # :flag.usage freeleaps password - printf " %s\n" "--freeleaps-password FREELEAPS_PASSWORD (optional)" - printf " Specifies the Freeleaps.com password repository (Optional).\n" - echo - - # :flag.usage use local component - printf " %s\n" "--use-local-component USE_LOCAL_COMPONENT" - printf " Check if use local component or use online dev environment. (Optional, default=false)\n" - echo - - # :flag.usage devsvc image repo - printf " %s\n" "--devsvc-image-repo DEVSVC_IMAGE_REPO" - printf " Specifies the repository for devsvc component. (Optional)\n" - echo - - # :flag.usage devsvc image name - printf " %s\n" "--devsvc-image-name DEVSVC_IMAGE_NAME" - printf " Specifies the image name for devsvc component. (Optional)\n" - echo - - # :flag.usage devsvc image tag - printf " %s\n" "--devsvc-image-tag DEVSVC_IMAGE_TAG" - printf " Specifies the image tag for devsvc component. (Optional, default=latest-linux-arm64)\n" - printf " %s\n" "Default: latest" - echo - - # :flag.usage notification, image repo - printf " %s\n" "--notification-image-repo NOTIFICATION_IMAGE_REPO" - printf " Specifies the repository for notification component. (Optional)\n" - echo - - # :flag.usage notification image name - printf " %s\n" "--notification-image-name NOTIFICATION_IMAGE_NAME" - printf " Specifies the image name for notification component. (Optional)\n" - echo - - # :flag.usage notification image tag - printf " %s\n" "--notification-image-tag NOTIFICATION_IMAGE_TAG" - printf " Specifies the image tag for notification component. (Optional, default=latest-linux-arm64)\n" - printf " %s\n" "Default: latest" - echo - - # :flag.usage content image repo - printf " %s\n" "--content-image-repo CONTENT_IMAGE_REPO" - printf " Specifies the repository for content component. (Optional)\n" - echo - - # :flag.usage content image name - printf " %s\n" "--content-image-name CONTENT_IMAGE_NAME" - printf " Specifies the image name for content component. (Optional)\n" - echo - - # :flag.usage content image tag - printf " %s\n" "--content-image-tag CONTENT_IMAGE_TAG" - printf " Specifies the image tag for content component. (Optional, default=latest-linux-arm64)\n" - printf " %s\n" "Default: latest" - echo - - # :flag.usage central storage image repo - printf " %s\n" "--central_storage-image-repo CENTRAL_STORAGE_IMAGE_REPO" - printf " Specifies the repository for central_storage component. (Optional)\n" - echo - - # :flag.usage central storage image name - printf " %s\n" "--central_storage-image-name CENTRAL_STORAGE_IMAGE_NAME" - printf " Specifies the image name for central_storage component. (Optional)\n" - echo - - # :flag.usage central storage image tag - printf " %s\n" "--central_storage-image-tag CENTRAL_STORAGE_IMAGE_TAG" - printf " Specifies the image tag for central_storage component. (Optional, default=latest-linux-arm64)\n" - printf " %s\n" "Default: latest" - echo - - # :flag.usage authentication image repo - printf " %s\n" "--authentication-image-repo AUTHENTICATION_IMAGE_REPO" - printf " Specifies the repository for authentication component. (Optional)\n" - echo - - # :flag.usage authentication image name - printf " %s\n" "--authentication-image-name AUTHENTICATION_IMAGE_NAME" - printf " Specifies the image name for authentication component. (Optional)\n" - echo - - # :flag.usage authentication image tag - printf " %s\n" "--authentication-image-tag AUTHENTICATION_IMAGE_TAG" - printf " Specifies the image tag for authentication component. (Optional, default=latest-linux-arm64)\n" - printf " %s\n" "Default: latest" - echo - - # :flag.usage force - printf " %s\n" "--force, -f" - printf " Force initialization even if resources already exist.\n" - echo - - # :command.usage_fixed_flags - printf " %s\n" "--help, -h" - printf " Show this help\n" - echo - - # :command.usage_examples - printf "%s\n" "Examples:" - printf " devbox init --os=linux --arch=arm64 --freeleaps-username alice\n --freeleaps-password secret\n" - printf " devbox init \ --devbox-container-name custom-devbox \ --devbox-container-port\n 22222 \ --freeleaps-username alice \ --freeleaps-password secret\n" - echo - - fi } # :command.usage devbox_deinit_usage() { if [[ -n $long_usage ]]; then - printf "devbox deinit\n\n" - printf " De-initialize the local development environment based on DevBox container.\n This command will stop and remove all containers, clean up the working \n directory, and reset the environment to the initial state.\n \n Sub-command \`deinit\` uses Docker (or another container runtime) to clean \n up the local DevBox environment for Freeleaps development. \n It follows these major steps:\n 1. Stop and remove all containers.\n 2. Clean up the working directory.\n 3. Reset the environment to the initial state.\n\n" + printf "Command\n" + printf " devbox deinit : De-initialize the local development environment based on DevBox container.\n\n" + + printf "Arguments\n" + printf " --working-home -w [Optional] : Specifies the working home of DevBox CLI. Default: %s/.devbox\n" "$HOME" + printf " --clear-logs -l [Optional] : Specifies whether to clear log files. Default: true\n" + printf " --clear-repo -r [Optional] : Specifies whether to delete the source repository. Default: false\n\n" + + printf "Global Arguments\n" + printf " --help, -h : Show this help message and exit.\n\n" + + printf "Examples\n" + printf " De-initialize the local development environment.\n" + printf " devbox deinit\n" + printf " De-initialize with custom working home and options.\n" + printf " devbox deinit --working-home=/tmp/devbox --clear-logs=false --clear-repo=true\n" else printf "devbox deinit - De-initialize the local development environment based on DevBox container.\n\n" fi - printf "Alias: d\n" - echo - - printf "%s\n" "Usage:" - printf " devbox deinit [OPTIONS]\n" - printf " devbox deinit --help | -h\n" - echo - - # :command.long_usage - if [[ -n "$long_usage" ]]; then - printf "%s\n" "Options:" - - # :command.usage_flags - # :flag.usage - printf " %s\n" "--working-home WORKING_HOME" - printf " Specifies the working home of DevBox CLI. Default is ${HOME}/.devbox.\n" - printf " %s\n" "Default: ${HOME}/.devbox" - echo - - # :flag.usage - printf " %s\n" "--clear-logs CLEAR_LOGS" - printf " Specifies whether clear log files or not. Default is true.\n" - printf " %s\n" "Default: true" - echo - - # :flag.usage - printf " %s\n" "--clear-repo CLEAR_REPO" - printf " Specifies whether delete source repository or not. Default is false.\n" - printf " %s\n" "Default: false" - echo - - # :command.usage_fixed_flags - printf " %s\n" "--help, -h" - printf " Show this help\n" - echo - - # :command.usage_examples - printf "%s\n" "Examples:" - printf " devbox deinit\n" - printf " devbox deinit --working-home=/tmp/devbox --clear-logs=false --clear-repo=true\n" - echo - - fi } # :command.usage devbox_start_usage() { if [[ -n $long_usage ]]; then - printf "devbox start\n\n" - printf " Start the local development environment based on DevBox container.\n This command will start all containers, services, and processes that \n are required for Freeleaps development.\n \n Sub-command \`start\` uses Docker (or another container runtime) to start \n the local DevBox environment for Freeleaps development. \n It follows these major steps:\n 1. Start all containers.\n 2. Start all services and processes.\n\n" + printf "Command\n" + printf " devbox start : Start the local development environment based on DevBox container.\n\n" + + printf "Arguments\n" + printf " --component COMPONENT [Optional] : Specifies the name of the component to start (e.g., mongodb, rabbitmq, backend, frontend, devsvc, content, central_storage, authentication).\n\n" + printf " --freeleaps-endpoint -e [Optional] : Specifies the Freeleaps.com endpoint to start in the DevBox container.\n\n" + printf "Global Arguments\n" + printf " --help, -h : Show this help message and exit.\n\n" + + printf "Examples\n" + printf " Start all components:\n" + printf " devbox start\n" + printf " Start a specific component (e.g., backend):\n" + printf " devbox start --component=backend\n" else printf "devbox start - Start the local development environment based on DevBox container.\n\n" fi printf "Alias: s\n" echo - - printf "%s\n" "Usage:" - printf " devbox start [OPTIONS]\n" - printf " devbox start --help | -h\n" - echo - - # :command.long_usage - if [[ -n "$long_usage" ]]; then - printf "%s\n" "Options:" - - # :command.usage_flags - # :flag.usage - printf " %s\n" "--component COMPONENT" - printf " Specifies the name of the component to start (e.g., mongodb, rabbitmq,\n backend, frontend, devsvc, content, central_storage,\n authentication).\n" - echo - - # :command.usage_fixed_flags - printf " %s\n" "--help, -h" - printf " Show this help\n" - echo - - # :command.usage_examples - printf "%s\n" "Examples:" - printf " devbox start\n" - printf " devbox start --component=backend\n" - echo - - fi } # :command.usage devbox_stop_usage() { if [[ -n $long_usage ]]; then - printf "devbox stop\n\n" - printf " Stop the local development environment based on DevBox container.\n This command will stop all containers, services, and processes that \n are required for Freeleaps development.\n \n Sub-command \`stop\` uses Docker (or another container runtime) to stop \n the local DevBox environment for Freeleaps development. \n It follows these major steps:\n 1. Stop all containers.\n 2. Stop all services and processes.\n\n" + printf "Command\n" + printf " devbox stop : Stop the local development environment based on DevBox container.\n\n" + printf "Arguments\n" + printf " --component -c [Optional] : Specifies the name of the component to stop (e.g., mongodb, rabbitmq, devbox, devsvc, content, central_storage, authentication).\n\n" + printf "Global Arguments\n" + printf " --help -h : Show this help message and exit.\n\n" + printf "Examples\n" + printf " Stop all components:\n" + printf " devbox stop\n\n" + printf " Stop a specific component (e.g., backend):\n" + printf " devbox stop --component=backend\n" else - printf "devbox stop - Stop the local development environment based on DevBox container.\n\n" + printf "devbox stop - Stop the local development environment based on DevBox container.\n" fi - printf "Alias: p\n" echo - - printf "%s\n" "Usage:" - printf " devbox stop [OPTIONS]\n" - printf " devbox stop --help | -h\n" - echo - - # :command.long_usage - if [[ -n "$long_usage" ]]; then - printf "%s\n" "Options:" - - # :command.usage_flags - # :flag.usage - printf " %s\n" "--component COMPONENT" - printf " Specifies the name of the component to stop (e.g., mongodb, rabbitmq,\n backend, frontend, devsvc, content, central_storage,\n authentication).\n" - echo - - # :command.usage_fixed_flags - printf " %s\n" "--help, -h" - printf " Show this help\n" - echo - - # :command.usage_examples - printf "%s\n" "Examples:" - printf " devbox stop\n" - printf " devbox stop --component=backend\n" - echo - - fi } # :command.usage devbox_status_usage() { if [[ -n $long_usage ]]; then - printf "devbox status\n\n" - printf " Display the status of the local development environment based on DevBox\n container.\n This command will show the status of all containers, services, and processes \n that are required for Freeleaps development.\n \n Sub-command \`status\` uses Docker (or another container runtime) to show \n the status of the local DevBox environment for Freeleaps development. \n It follows these major steps:\n 1. Show the status of all containers.\n 2. Show the status of all services and processes.\n\n" + printf "Command\n" + printf " devbox status : Display the status of the local development environment based on DevBox container.\n\n" + + printf "Arguments\n" + printf " --component -c [Optional] : Specifies the component to show status (e.g., devbox, devsvc, etc.).\n\n" + + printf "Global Arguments\n" + printf " --help -h : Show this help message and exit.\n\n" + + printf "Examples\n" + printf " Display status for all components:\n" + printf " devbox status\n\n" + printf " Display status for a specific component:\n" + printf " devbox status --component=backend\n" else - printf "devbox status - Display the status of the local development environment based on DevBox container.\n\n" + printf "devbox status - Display the status of the local development environment based on DevBox container.\n" fi - printf "Alias: t\n" echo - - printf "%s\n" "Usage:" - printf " devbox status\n" - printf " devbox status --help | -h\n" - echo - - # :command.long_usage - if [[ -n "$long_usage" ]]; then - printf "%s\n" "Options:" - - # :command.usage_fixed_flags - printf " %s\n" "--help, -h" - printf " Show this help\n" - echo - - # :command.usage_examples - printf "%s\n" "Examples:" - printf " devbox status\n" - printf " devbox status --component=backend\n" - echo - - fi } # :command.usage devbox_restart_usage() { if [[ -n $long_usage ]]; then - printf "devbox restart\n\n" - printf " Restart the local development environment based on DevBox container.\n This command will restart all containers, services, and processes that \n are required for Freeleaps development.\n \n Sub-command \`restart\` uses Docker (or another container runtime) to restart \n the local DevBox environment for Freeleaps development. \n It follows these major steps:\n 1. Stop all containers.\n 2. Start all containers.\n 3. Stop all services and processes.\n 4. Start all services and processes.\n\n" + printf "Command\n" + printf " devbox restart : Restart the local development environment based on DevBox container.\n\n" + printf "Arguments\n" + printf " --component -c [Optional] : Specifies the component to restart (e.g., backend, frontend, etc.).\n" + printf " --freeleaps-endpoint -e [Optional] : Specifies the Freeleaps.com endpoint to restart in the DevBox container.\n" + printf " --force -f : Force the restart operation without prompt.\n\n" + printf "Global Arguments\n" + printf " --help -h : Show this help message and exit.\n" + printf "Examples\n" + printf " Restart all components:\n" + printf " devbox restart\n\n" + printf " Restart a specific component (e.g., backend):\n" + printf " devbox restart --component=backend\n" else printf "devbox restart - Restart the local development environment based on DevBox container.\n\n" fi printf "Alias: r\n" echo - - printf "%s\n" "Usage:" - printf " devbox restart\n" - printf " devbox restart --help | -h\n" - echo - - # :command.long_usage - if [[ -n "$long_usage" ]]; then - printf "%s\n" "Options:" - - # :command.usage_fixed_flags - printf " %s\n" "--help, -h" - printf " Show this help\n" - echo - - # :command.usage_examples - printf "%s\n" "Examples:" - printf " devbox restart\n" - printf " devbox restart --component=backend\n" - echo - - fi } # :command.normalize_input @@ -1201,6 +943,7 @@ else export FREELEAPS_AILAB_ENDPOINT=https://as010-w2-re-vm.mathmast.com:8009/api/ export KAFKA_SERVER_URL='' export EMAIL_FROM=freeleaps@freeleaps.com + export JWT_SECRET_KEY=ea84edf152976b2fcec12b78aa8e45bc26a5cf0ef61bf16f5c317ae33b3fd8b0 EOFinner fi @@ -2140,11 +1883,9 @@ devbox_init_parse_requirements() { devbox_init_usage exit ;; - *) break ;; - esac done @@ -2156,147 +1897,137 @@ devbox_init_parse_requirements() { key="$1" case "$key" in # :flag.case - --os) - + --os | -o) # :flag.case_arg if [[ -n ${2+x} ]]; then add_arg '--os' "$2" - shift - shift + shift 2 else printf "%s\n" "--os requires an argument: --os OS" >&2 exit 1 fi ;; - # :flag.case - --arch) - + --arch | -a) # :flag.case_arg if [[ -n ${2+x} ]]; then add_arg '--arch' "$2" - shift - shift + shift 2 else printf "%s\n" "--arch requires an argument: --arch ARCH" >&2 exit 1 fi ;; - # :flag.case - --devbox-container-name) - + --devbox-container-name | -N) # :flag.case_arg if [[ -n ${2+x} ]]; then add_arg '--devbox-container-name' "$2" - shift - shift + shift 2 else printf "%s\n" "--devbox-container-name requires an argument: --devbox-container-name DEVBOX_CONTAINER_NAME" >&2 exit 1 fi ;; - # :flag.case - --devbox-container-port) - + --devbox-container-port | -P) # :flag.case_arg if [[ -n ${2+x} ]]; then add_arg '--devbox-container-port' "$2" - shift - shift + shift 2 else printf "%s\n" "--devbox-container-port requires an argument: --devbox-container-port DEVBOX_CONTAINER_PORT" >&2 exit 1 fi ;; - + --devbox-frontend-port | -F) + # :flag.case_arg + if [[ -n ${2+x} ]]; then + add_arg '--devbox-frontend-port' "$2" + shift 2 + else + printf "%s\n" "--devbox-frontend-port requires an argument: --devbox-frontend-port DEVBOX_FRONTEND_PORT" >&2 + exit 1 + fi + ;; + --devbox-backend-port | -B) + # :flag.case_arg + if [[ -n ${2+x} ]]; then + add_arg '--devbox-backend-port' "$2" + shift 2 + else + printf "%s\n" "--devbox-backend-port requires an argument: --devbox-backend-port DEVBOX_BACKEND_PORT" >&2 + exit 1 + fi + ;; # :flag.case - --devbox-image-repo) - + --devbox-image-repo | -R) # :flag.case_arg if [[ -n ${2+x} ]]; then add_arg '--devbox-image-repo' "$2" - shift - shift + shift 2 else printf "%s\n" "--devbox-image-repo requires an argument: --devbox-image-repo DEVBOX_IMAGE_REPO" >&2 exit 1 fi ;; - # :flag.case - --devbox-image-name) - + --devbox-image-name | -I) # :flag.case_arg if [[ -n ${2+x} ]]; then add_arg '--devbox-image-name' "$2" - shift - shift + shift 2 else printf "%s\n" "--devbox-image-name requires an argument: --devbox-image-name DEVBOX_IMAGE_NAME" >&2 exit 1 fi ;; - # :flag.case - --devbox-image-tag) - + --devbox-image-tag | -T) # :flag.case_arg if [[ -n ${2+x} ]]; then add_arg '--devbox-image-tag' "$2" - shift - shift + shift 2 else printf "%s\n" "--devbox-image-tag requires an argument: --devbox-image-tag DEVBOX_IMAGE_TAG" >&2 exit 1 fi ;; - # :flag.case - --working-home) - + --working-home | -w) # :flag.case_arg if [[ -n ${2+x} ]]; then add_arg '--working-home' "$2" - shift - shift + shift 2 else printf "%s\n" "--working-home requires an argument: --working-home WORKING_HOME" >&2 exit 1 fi ;; - # :flag.case - --freeleaps-username) - + --freeleaps-username | -U) # :flag.case_arg if [[ -n ${2+x} ]]; then add_arg '--freeleaps-username' "$2" - shift - shift + shift 2 else printf "%s\n" "--freeleaps-username requires an argument: --freeleaps-username FREELEAPS_USERNAME" >&2 exit 1 fi ;; - # :flag.case - --freeleaps-password) - + --freeleaps-password | -X) # :flag.case_arg if [[ -n ${2+x} ]]; then add_arg '--freeleaps-password' "$2" - shift - shift + shift 2 else printf "%s\n" "--freeleaps-password requires an argument: --freeleaps-password FREELEAPS_PASSWORD" >&2 exit 1 fi ;; - - # :flag.case - --use-local-component) + # :flag.case + --use-local-component | -u) if [[ -n ${2+x} ]]; then add_arg '--use-local-component' "$2" shift 2 @@ -2305,173 +2036,180 @@ devbox_init_parse_requirements() { exit 1 fi ;; - # :flag.case - --devsvc-image-repo) - + --devsvc-image-repo | -D) # :flag.case_arg if [[ -n ${2+x} ]]; then add_arg '--devsvc-image-repo' "$2" - shift - shift + shift 2 else printf "%s\n" "--devsvc-image-repo requires an argument: --devsvc-image-repo DEVSVC_IMAGE_REPO" >&2 exit 1 fi ;; - # :flag.case - --devsvc-image-name) - + --devsvc-image-name | -M) # :flag.case_arg if [[ -n ${2+x} ]]; then add_arg '--devsvc-image-name' "$2" - shift - shift + shift 2 else printf "%s\n" "--devsvc-image-name requires an argument: --devsvc-image-name DEVSVC_IMAGE_NAME" >&2 exit 1 fi ;; - # :flag.case - --devsvc-image-tag) - + --devsvc-image-tag | -G) # :flag.case_arg if [[ -n ${2+x} ]]; then add_arg '--devsvc-image-tag' "$2" - shift - shift + shift 2 else printf "%s\n" "--devsvc-image-tag requires an argument: --devsvc-image-tag DEVSVC_IMAGE_TAG" >&2 exit 1 fi ;; - - # :flag.case - --content-image-repo) - if [[ -n ${2+x} ]]; then - add_arg '--content-image-repo' "$2" - shift 2 - else - printf "%s\n" "--content-image-repo requires an argument: --content-image-repo FREELEAPS_CONTENT_IMAGE_REPO" >&2 - exit 1 - fi - ;; - - # :flag.case - --content-image-name) - if [[ -n ${2+x} ]]; then - add_arg '--content-image-name' "$2" - shift 2 - else - printf "%s\n" "--content-image-name requires an argument: --content-image-name FREELEAPS_CONTENT_IMAGE_NAME" >&2 - exit 1 - fi - ;; - - # :flag.case - --content-image-tag) - if [[ -n ${2+x} ]]; then - add_arg '--content-image-tag' "$2" - shift 2 - else - printf "%s\n" "--content-image-tag requires an argument: --content-image-tag FREELEAPS_CONTENT_IMAGE_TAG" >&2 - exit 1 - fi - ;; - - # :flag.case - --central_storage-image-repo) - if [[ -n ${2+x} ]]; then - add_arg '--central_storage-image-repo' "$2" - shift 2 - else - printf "%s\n" "--central_storage-image-repo requires an argument: --central_storage-image-repo FREELEAPS_CENTRAL_STORAGE_IMAGE_REPO" >&2 - exit 1 - fi - ;; - - # :flag.case - --central_storage-image-name) - if [[ -n ${2+x} ]]; then - add_arg '--central_storage-image-name' "$2" - shift 2 - else - printf "%s\n" "--central_storage-image-name requires an argument: --central_storage-image-name FREELEAPS_CENTRAL_STORAGE_IMAGE_NAME" >&2 - exit 1 - fi - ;; - - # :flag.case - --central_storage-image-tag) - if [[ -n ${2+x} ]]; then - add_arg '--central_storage-image-tag' "$2" - shift 2 - else - printf "%s\n" "--central_storage-image-tag requires an argument: --central_storage-image-tag FREELEAPS_CENTRAL_STORAGE_IMAGE_TAG" >&2 - exit 1 - fi - ;; - - # :flag.case - --authentication-image-repo) - if [[ -n ${2+x} ]]; then - add_arg '--authentication-image-repo' "$2" - shift 2 - else - printf "%s\n" "--authentication-image-repo requires an argument: --authentication-image-repo FREELEAPS_AUTHENTICATION_IMAGE_REPO" >&2 - exit 1 - fi - ;; - - # :flag.case - --authentication-image-name) - if [[ -n ${2+x} ]]; then - add_arg '--authentication-image-name' "$2" - shift 2 - else - printf "%s\n" "--authentication-image-name requires an argument: --authentication-image-name FREELEAPS_AUTHENTICATION_IMAGE_NAME" >&2 - exit 1 - fi - ;; - - # :flag.case - --authentication-image-tag) - if [[ -n ${2+x} ]]; then - add_arg '--authentication-image-tag' "$2" - shift 2 - else - printf "%s\n" "--authentication-image-tag requires an argument: --authentication-image-tag FREELEAPS_AUTHENTICATION_IMAGE_TAG" >&2 - exit 1 - fi - ;; + # :flag.case + --notification-image-repo | -Y) + # :flag.case_arg + if [[ -n ${2+x} ]]; then + add_arg '--notification-image-repo' "$2" + shift 2 + else + printf "%s\n" "--notification-image-repo requires an argument: --notification-image-repo NOTIFICATION_IMAGE_REPO" >&2 + exit 1 + fi + ;; + --notification-image-name | -K) + # :flag.case_arg + if [[ -n ${2+x} ]]; then + add_arg '--notification-image-name' "$2" + shift 2 + else + printf "%s\n" "--notification-image-name requires an argument: --notification-image-name NOTIFICATION_IMAGE_NAME" >&2 + exit 1 + fi + ;; + --notification-image-tag | -Z) + # :flag.case_arg + if [[ -n ${2+x} ]]; then + add_arg '--notification-image-tag' "$2" + shift 2 + else + printf "%s\n" "--notification-image-tag requires an argument: --notification-image-tag NOTIFICATION_IMAGE_TAG" >&2 + exit 1 + fi + ;; + # :flag.case + --content-image-repo | -C) + if [[ -n ${2+x} ]]; then + add_arg '--content-image-repo' "$2" + shift 2 + else + printf "%s\n" "--content-image-repo requires an argument: --content-image-repo FREELEAPS_CONTENT_IMAGE_REPO" >&2 + exit 1 + fi + ;; + # :flag.case + --content-image-name | -E) + if [[ -n ${2+x} ]]; then + add_arg '--content-image-name' "$2" + shift 2 + else + printf "%s\n" "--content-image-name requires an argument: --content-image-name FREELEAPS_CONTENT_IMAGE_NAME" >&2 + exit 1 + fi + ;; + # :flag.case + --content-image-tag | -H) + if [[ -n ${2+x} ]]; then + add_arg '--content-image-tag' "$2" + shift 2 + else + printf "%s\n" "--content-image-tag requires an argument: --content-image-tag FREELEAPS_CONTENT_IMAGE_TAG" >&2 + exit 1 + fi + ;; + # :flag.case + --central_storage-image-repo | -S) + if [[ -n ${2+x} ]]; then + add_arg '--central_storage-image-repo' "$2" + shift 2 + else + printf "%s\n" "--central_storage-image-repo requires an argument: --central_storage-image-repo FREELEAPS_CENTRAL_STORAGE_IMAGE_REPO" >&2 + exit 1 + fi + ;; + # :flag.case + --central_storage-image-name | -J) + if [[ -n ${2+x} ]]; then + add_arg '--central_storage-image-name' "$2" + shift 2 + else + printf "%s\n" "--central_storage-image-name requires an argument: --central_storage-image-name FREELEAPS_CENTRAL_STORAGE_IMAGE_NAME" >&2 + exit 1 + fi + ;; + # :flag.case + --central_storage-image-tag | -Q) + if [[ -n ${2+x} ]]; then + add_arg '--central_storage-image-tag' "$2" + shift 2 + else + printf "%s\n" "--central_storage-image-tag requires an argument: --central_storage-image-tag FREELEAPS_CENTRAL_STORAGE_IMAGE_TAG" >&2 + exit 1 + fi + ;; + # :flag.case + --authentication-image-repo | -V) + if [[ -n ${2+x} ]]; then + add_arg '--authentication-image-repo' "$2" + shift 2 + else + printf "%s\n" "--authentication-image-repo requires an argument: --authentication-image-repo FREELEAPS_AUTHENTICATION_IMAGE_REPO" >&2 + exit 1 + fi + ;; + # :flag.case + --authentication-image-name | -L) + if [[ -n ${2+x} ]]; then + add_arg '--authentication-image-name' "$2" + shift 2 + else + printf "%s\n" "--authentication-image-name requires an argument: --authentication-image-name FREELEAPS_AUTHENTICATION_IMAGE_NAME" >&2 + exit 1 + fi + ;; + # :flag.case + --authentication-image-tag | -W) + if [[ -n ${2+x} ]]; then + add_arg '--authentication-image-tag' "$2" + shift 2 + else + printf "%s\n" "--authentication-image-tag requires an argument: --authentication-image-tag FREELEAPS_AUTHENTICATION_IMAGE_TAG" >&2 + exit 1 + fi + ;; # :flag.case --force | -f) - # :flag.case_no_arg add_arg '--force' '1' shift ;; - -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 ;; - *) # :command.parse_requirements_case # :command.parse_requirements_case_simple printf "invalid argument: %s\n" "$key" >&2 exit 1 - ;; - esac done # :command.default_assignments - if [ -z "$(get_arg '--os')" ]; then add_arg '--os' "auto" fi @@ -2545,7 +2283,6 @@ devbox_deinit_parse_requirements() { devbox_deinit_usage exit ;; - *) break ;; @@ -2561,7 +2298,7 @@ devbox_deinit_parse_requirements() { key="$1" case "$key" in # :flag.case - --working-home) + --working-home | -w) # :flag.case_arg if [[ -n ${2+x} ]]; then @@ -2575,7 +2312,7 @@ devbox_deinit_parse_requirements() { ;; # :flag.case - --clear-logs) + --clear-logs | -l) # :flag.case_arg if [[ -n ${2+x} ]]; then @@ -2589,7 +2326,7 @@ devbox_deinit_parse_requirements() { ;; # :flag.case - --clear-repo) + --clear-repo | -r) # :flag.case_arg if [[ -n ${2+x} ]]; then @@ -2659,7 +2396,7 @@ devbox_start_parse_requirements() { key="$1" case "$key" in # :flag.case - --component) + --component | -c) # :flag.case_arg if [[ -n ${2+x} ]]; then @@ -2672,7 +2409,7 @@ devbox_start_parse_requirements() { fi ;; - --freeleaps-endpoint) + --freeleaps-endpoint | -e) # :flag.case_arg if [[ -n ${2+x} ]]; then @@ -2735,7 +2472,7 @@ devbox_stop_parse_requirements() { key="$1" case "$key" in # :flag.case - --component) + --component | -c) # :flag.case_arg if [[ -n ${2+x} ]]; then @@ -2793,7 +2530,7 @@ devbox_status_parse_requirements() { key="$1" case "$key" in # :flag.case - --component) + --component | -c) # :flag.case_arg if [[ -n ${2+x} ]]; then @@ -2852,7 +2589,7 @@ devbox_restart_parse_requirements() { key="$1" case "$key" in # :flag.case - --component) + --component | -c) # :flag.case_arg if [[ -n ${2+x} ]]; then @@ -2864,7 +2601,7 @@ devbox_restart_parse_requirements() { exit 1 fi ;; - --freeleaps-endpoint) + --freeleaps-endpoint | -e) # :flag.case_arg if [[ -n ${2+x} ]]; then