@@ -49,9 +49,9 @@ enum Commands {
4949 resource : String ,
5050 /// Optional resource name
5151 name : Option < String > ,
52- /// ECS cluster name
53- #[ arg( long, default_value = "default" ) ]
54- cluster : String ,
52+ /// ECS cluster name (default: from ~/.oabctl/config.toml)
53+ #[ arg( long) ]
54+ cluster : Option < String > ,
5555 } ,
5656 /// Delete an OAB service
5757 Delete {
@@ -63,13 +63,12 @@ enum Commands {
6363 /// instead of specifying <resource> <name> directly (mirrors `apply -f`)
6464 #[ arg( short, long, conflicts_with_all = [ "resource" , "name" ] ) ]
6565 file : Option < String > ,
66- /// ECS cluster name (ignored when using -f — manifests are always
67- /// deployed to the "oab" cluster, same as `apply`)
68- #[ arg( long, default_value = "default" ) ]
69- cluster : String ,
70- /// Namespace (ignored when using -f — read from each manifest instead)
71- #[ arg( long, default_value = "prod" ) ]
72- namespace : String ,
66+ /// ECS cluster name (default: from ~/.oabctl/config.toml; ignored when using -f)
67+ #[ arg( long) ]
68+ cluster : Option < String > ,
69+ /// Namespace (default: from ~/.oabctl/config.toml; ignored when using -f)
70+ #[ arg( long) ]
71+ namespace : Option < String > ,
7372 } ,
7473 /// Execute a command in an agent container (via ecsctl)
7574 Exec {
@@ -133,13 +132,20 @@ async fn main() -> anyhow::Result<()> {
133132 match cli. command {
134133 Commands :: Apply { file, no_sync, wait } => apply:: run ( & config, & file, !no_sync, wait) . await ,
135134 Commands :: Create { name, namespace, auto_apply } => create:: run ( & config, & name, & namespace, auto_apply) . await ,
136- Commands :: Get { resource, name, cluster } => get:: run ( & config, & resource, name. as_deref ( ) , & cluster) . await ,
135+ Commands :: Get { resource, name, cluster } => {
136+ let oab_cfg = config:: OabConfig :: load ( ) . context ( "failed to load ~/.oabctl/config.toml" ) ?;
137+ let cluster = cluster. unwrap_or ( oab_cfg. defaults . cluster ) ;
138+ get:: run ( & config, & resource, name. as_deref ( ) , & cluster) . await
139+ }
137140 Commands :: Delete { resource, name, file, cluster, namespace } => {
138141 if let Some ( file) = file {
139142 delete:: run_from_file ( & config, & file) . await
140143 } else {
141144 let resource = resource. context ( "<RESOURCE> is required when not using -f" ) ?;
142145 let name = name. context ( "<NAME> is required when not using -f" ) ?;
146+ let oab_cfg = config:: OabConfig :: load ( ) . context ( "failed to load ~/.oabctl/config.toml" ) ?;
147+ let cluster = cluster. unwrap_or ( oab_cfg. defaults . cluster ) ;
148+ let namespace = namespace. unwrap_or ( oab_cfg. defaults . namespace ) ;
143149 delete:: run ( & config, & resource, & name, & cluster, & namespace) . await
144150 }
145151 }
0 commit comments