@@ -39,6 +39,7 @@ FORCE=false
3939TIMEOUT=60
4040LOG_LEVEL=" "
4141TRACE_ENABLED=false
42+ NO_START=false # Flag to create container without starting it
4243
4344# =============================================================================
4445# FUNCTION: initialize_system
@@ -105,25 +106,22 @@ initialize_system() {
105106# =============================================================================
106107route_operation () {
107108 case " $OPERATION " in
108- " generate" )
109+ " generate" | " install " )
109110 handle_generate
110111 ;;
111- " install " )
112- handle_install
112+ " update " | " refresh " )
113+ handle_update
113114 ;;
114- " reinstall" )
115- handle_reinstall
116- ;;
117- " start" |" run" )
115+ " start" |" run" |" up" )
118116 handle_start
119117 ;;
120- " stop" )
118+ " stop" | " down " )
121119 handle_stop
122120 ;;
123121 " restart" )
124122 handle_restart
125123 ;;
126- " cleanup " )
124+ " clean " | " delete " | " remove " )
127125 # Check for --all flag to cleanup state-managed containers only
128126 if [[ ${# CONTAINER_NAMES[@]} -eq 1 && " ${CONTAINER_NAMES[0]} " == " --all" ]]; then
129127 print_section " Cleaning up all state-managed containers"
@@ -151,7 +149,7 @@ route_operation() {
151149 source " $SCRIPT_DIR /operations/cleanup.sh"
152150 nuke_docker_system " $FORCE "
153151 ;;
154- " status" )
152+ " status" | " state " )
155153 handle_status
156154 ;;
157155 " logs" )
@@ -160,17 +158,18 @@ route_operation() {
160158 " list" )
161159 handle_list
162160 ;;
163- " config" )
164- handle_config
165- ;;
166- " state" )
167- handle_state
168- ;;
169- " env" )
161+ " config" |" env" )
170162 handle_env
171163 ;;
172164 " help" )
173- print_help
165+ if [[ ${# CONTAINER_NAMES[@]} -gt 0 ]]; then
166+ # Command-specific help
167+ local command=" ${CONTAINER_NAMES[0]} "
168+ print_command_help " $command "
169+ else
170+ # General help
171+ print_help
172+ fi
174173 ;;
175174 * )
176175 print_error " Unknown operation: $OPERATION "
@@ -270,6 +269,32 @@ handle_generate() {
270269 fi
271270}
272271
272+ # =============================================================================
273+ # FUNCTION: handle_update
274+ # =============================================================================
275+ # Purpose: Handle the update/refresh operation to update containers
276+ # Inputs: None (uses global variables)
277+ # Outputs: None
278+ # Side Effects: Sources and calls update operation module
279+ # Usage: Called by route_operation when operation is "update" or "refresh"
280+ # =============================================================================
281+ handle_update () {
282+ local containers=($( get_target_containers) )
283+
284+ if [[ ${# containers[@]} -eq 1 ]]; then
285+ local container_name=" ${containers[0]} "
286+ print_section " Updating container: $container_name "
287+
288+ source " $SCRIPT_DIR /operations/install.sh"
289+ update_container " $container_name "
290+ else
291+ print_section " Updating multiple containers"
292+
293+ source " $SCRIPT_DIR /operations/install.sh"
294+ update_multiple_containers " ${containers[@]} "
295+ fi
296+ }
297+
273298# =============================================================================
274299# FUNCTION: handle_install
275300# =============================================================================
@@ -510,14 +535,23 @@ handle_list() {
510535 source " $SCRIPT_DIR /operations/list.sh"
511536
512537 local resource_type=" all"
538+ local filter=" all"
539+
513540 if [[ ${# CONTAINER_NAMES[@]} -gt 0 ]]; then
514541 resource_type=" ${CONTAINER_NAMES[0]} "
542+
543+ # Check for special filter options
544+ if [[ " $resource_type " == " running" || " $resource_type " == " lr" ]]; then
545+ resource_type=" containers"
546+ filter=" running"
547+ fi
515548 fi
549+
516550 local format=" table"
517551
518552 case " $resource_type " in
519553 " containers" |" container" )
520- list_containers " $format " " all "
554+ list_containers " $format " " $filter "
521555 ;;
522556 " images" |" image" )
523557 list_images " $format " " all"
@@ -537,6 +571,7 @@ handle_list() {
537571 * )
538572 print_error " Unknown resource type: $resource_type "
539573 print_info " Available resource types: containers, images, projects, volumes, networks, all"
574+ print_info " Special filters: running, lr (for running containers only)"
540575 exit 1
541576 ;;
542577 esac
0 commit comments