@@ -42,8 +42,8 @@ extension Application {
4242// MARK: - Shared Options
4343
4444struct  ComposeOptions :  ParsableArguments  { 
45-     @Option ( name:  [ . customLong( " file " ) ,  . customShort( " f " ) ] ,  help:  " Specify an alternate  compose file " )  
46-     var  file :  String  =  " docker-compose.yaml " 
45+     @Option ( name:  [ . customLong( " file " ) ,  . customShort( " f " ) ] ,  help:  " Specify compose file(s) (can be used multiple times)  " )  
46+     var  file :  [ String ]  =  [ ] 
4747
4848    @Option ( name:  [ . customLong( " project " ) ,  . customShort( " p " ) ] ,  help:  " Specify an alternate project name " )  
4949    var  project :  String ? 
@@ -64,13 +64,40 @@ struct ComposeOptions: ParsableArguments {
6464        return  url. lastPathComponent. lowercased ( ) . replacingOccurrences ( of:  "   " ,  with:  " " ) 
6565    } 
6666
67-     func  getComposeFileURL( )  ->  URL  { 
68-         if  file. hasPrefix ( " / " )  { 
69-             return  URL ( fileURLWithPath:  file) 
70-         }  else  { 
71-             let  currentPath  =  FileManager . default. currentDirectoryPath
72-             return  URL ( fileURLWithPath:  currentPath) . appendingPathComponent ( file) 
67+     func  getComposeFileURLs( )  ->  [ URL ]  { 
68+         // If no files specified, use default
69+         let  files  =  file. isEmpty ?  [ " docker-compose.yaml " ,  " docker-compose.yml " ,  " compose.yaml " ,  " compose.yml " ]  :  file
70+         
71+         var  urls :  [ URL ]  =  [ ] 
72+         let  currentPath  =  FileManager . default. currentDirectoryPath
73+         
74+         for  fileName  in  files { 
75+             let  url :  URL 
76+             if  fileName. hasPrefix ( " / " )  { 
77+                 url =  URL ( fileURLWithPath:  fileName) 
78+             }  else  { 
79+                 url =  URL ( fileURLWithPath:  currentPath) . appendingPathComponent ( fileName) 
80+             } 
81+             
82+             // For default files, only add if they exist
83+             if  file. isEmpty { 
84+                 if  FileManager . default. fileExists ( atPath:  url. path)  { 
85+                     urls. append ( url) 
86+                     break  // Use first found default file
87+                 } 
88+             }  else  { 
89+                 // For explicitly specified files, add them all (parser will check existence)
90+                 urls. append ( url) 
91+             } 
92+         } 
93+         
94+         // If no files found from defaults, return the first default for error message
95+         if  urls. isEmpty && file. isEmpty { 
96+             let  defaultFile  =  URL ( fileURLWithPath:  currentPath) . appendingPathComponent ( " docker-compose.yaml " ) 
97+             urls. append ( defaultFile) 
7398        } 
99+         
100+         return  urls
74101    } 
75102
76103    func  setEnvironmentVariables( )  { 
0 commit comments