File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,28 +7,35 @@ function container::internal::container::install {
77 fi
88 message_info " Installing ${ZSH_DOCKER_PACKAGE_NAME} "
99 core::install colima
10+
11+ if ! core::exists docker; then
12+ core::install docker
13+ fi
14+
1015 message_success " Installed ${ZSH_DOCKER_PACKAGE_NAME} "
1116}
1217
13- function container::internal::container::load {
14- # Check if jq is installed
15- if ! command -v jq > /dev/null 2>&1 ; then
16- echo " β 'jq' is required but not installed. Please install it with: brew install jq"
18+ function check_command {
19+ if ! command -v " $1 " > /dev/null 2>&1 ; then
20+ echo " β '$1 ' is required but not installed. Please install it with: brew install $1 "
1721 return 1
1822 fi
23+ return 0
24+ }
1925
20- # Check if colima is installed
21- if ! command -v colima > /dev/null 2>&1 ; then
22- echo " β 'colima' is required but not installed. Please install it with: brew install colima"
23- return 1
24- fi
26+ function container::internal::container::load {
27+ check_command jq || return 1
28+ check_command colima || return 1
2529
26- # Get current Colima machine status
2730 local status
28- status=$( colima status --json | jq -r ' .status' )
31+ if ! status=$( colima status --json 2> /dev/null | jq -r ' .status' ) ; then
32+ echo " β οΈ Could not get Colima status. Starting Colima..."
33+ colima start
34+ return
35+ fi
2936
3037 if [[ " $status " != " Running" ]]; then
3138 echo " π Colima is not running. Starting Colima..."
3239 colima start
3340 fi
34- }
41+ }
You canβt perform that action at this time.
0 commit comments