@@ -86,7 +86,7 @@ impl Bundle {
8686 ) ;
8787 }
8888 }
89- pub fn run < T : Borrow < str > > ( & self , keys : & [ T ] ) -> Result < ( ) , anyhow:: Error > {
89+ pub fn run < T : Borrow < str > > ( & self , keys : & [ T ] , flags : & [ impl Borrow < str > ] ) -> Result < ( ) , anyhow:: Error > {
9090 let ( Some ( ( endpoint, environments) ) , _) = self . find ( keys) else {
9191 error ! ( "couldn't find endpoint with {}" , keys. join( "." ) ) ;
9292 return Ok ( ( ) ) ;
@@ -114,7 +114,7 @@ impl Bundle {
114114 entry. or_insert ( value. clone ( ) ) ;
115115 } ) ;
116116 let built_endpoint = endpoint. substitute ( & config_store) ?;
117- built_endpoint. execute ( current_env. as_ref ( ) . try_into ( ) ?, & mut config_store)
117+ built_endpoint. execute ( current_env. as_ref ( ) . try_into ( ) ?, & mut config_store, flags )
118118 }
119119
120120 fn build ( package : & impl Borrow < str > , service_mods : HashMap < String , ServiceModule > ) -> Self {
@@ -279,9 +279,10 @@ impl EndPoint<NotSubstituted> {
279279}
280280
281281impl EndPoint < Substituted > {
282- fn execute ( self , base_url : url:: Url , config_store : & mut Store ) -> anyhow:: Result < ( ) > {
283- let request_hook_flags = Option :: < & str > :: None . as_slice ( ) ;
284- let response_hook_flags = Option :: < & str > :: None . as_slice ( ) ;
282+ fn execute ( self , base_url : url:: Url , config_store : & mut Store , flags : & [ impl Borrow < str > ] ) -> anyhow:: Result < ( ) > {
283+ let mut flags_iter = flags. split ( |flag| & flag. borrow ( ) == & "--" ) ;
284+ let request_hook_flags = flags_iter. next ( ) . unwrap_or ( & [ ] ) ;
285+ let response_hook_flags = flags_iter. next ( ) . unwrap_or ( & [ ] ) ;
285286 let Self {
286287 method,
287288 mut headers,
0 commit comments