@@ -38,24 +38,24 @@ deploy_examples() {
3838 local examples=(" $@ " )
3939 local pids=()
4040 local results=()
41-
41+
4242 echo -e " ${BLUE} Starting deployment of ${# examples[@]} examples...${NC} "
43-
43+
4444 # Start all deployments in the background
4545 for example in " ${examples[@]} " ; do
4646 local example_dir=$( dirname " $example " )
4747 local example_name=$( basename " $example_dir " )
48-
48+
4949 echo -e " ${YELLOW} Deploying ${example_name} ...${NC} "
50-
50+
5151 # Change to the example directory and run deploy.sh
5252 (cd " $example_dir " && ./deploy.sh > /tmp/deploy_${example_name} .log 2>&1 )&
53-
53+
5454 # Store the PID and example name
5555 pids+=($! )
5656 results+=(" $example_name " )
5757 done
58-
58+
5959 # Wait for all deployments to finish
6060 for i in " ${! pids[@]} " ; do
6161 if wait " ${pids[$i]} " ; then
@@ -65,7 +65,7 @@ deploy_examples() {
6565 echo -e " ${YELLOW} See log at /tmp/deploy_${results[$i]} .log${NC} "
6666 fi
6767 done
68-
68+
6969 echo -e " ${BLUE} All deployments completed.${NC} "
7070}
7171
@@ -74,29 +74,29 @@ main() {
7474 # Check if Modal CLI is installed and authenticated
7575 check_modal_cli
7676 check_modal_auth
77-
77+
7878 # Find all examples with deploy.sh scripts
7979 examples=($( find_examples) )
80-
80+
8181 if [ ${# examples[@]} -eq 0 ]; then
8282 echo -e " ${RED} No examples with deploy.sh scripts found.${NC} "
8383 exit 1
8484 fi
85-
85+
8686 # Display the list of available examples
8787 echo -e " ${BLUE} Available examples:${NC} "
8888 for i in " ${! examples[@]} " ; do
8989 local example_dir=$( dirname " ${examples[$i]} " )
9090 local example_name=$( basename " $example_dir " )
9191 echo -e " ${YELLOW} $(( i+ 1 )) .${NC} $example_name "
9292 done
93-
93+
9494 # Prompt for selection
9595 echo -e " ${BLUE} Enter the numbers of the examples you want to deploy (space-separated), or 'all' for all examples:${NC} "
9696 read -r selection
97-
97+
9898 selected_examples=()
99-
99+
100100 if [ " $selection " == " all" ]; then
101101 selected_examples=(" ${examples[@]} " )
102102 else
@@ -109,28 +109,28 @@ main() {
109109 fi
110110 done
111111 fi
112-
112+
113113 if [ ${# selected_examples[@]} -eq 0 ]; then
114114 echo -e " ${RED} No valid examples selected.${NC} "
115115 exit 1
116116 fi
117-
117+
118118 # Confirm the selection
119119 echo -e " ${BLUE} You selected the following examples:${NC} "
120120 for example in " ${selected_examples[@]} " ; do
121121 local example_dir=$( dirname " $example " )
122122 local example_name=$( basename " $example_dir " )
123123 echo -e " ${YELLOW} •${NC} $example_name "
124124 done
125-
125+
126126 echo -e " ${BLUE} Do you want to deploy these examples? (y/n)${NC} "
127127 read -r confirm
128-
128+
129129 if [ " $confirm " != " y" ] && [ " $confirm " != " Y" ]; then
130130 echo -e " ${RED} Deployment cancelled.${NC} "
131131 exit 0
132132 fi
133-
133+
134134 # Deploy the selected examples
135135 deploy_examples " ${selected_examples[@]} "
136136}
0 commit comments