@@ -1544,9 +1544,17 @@ enum SandboxCommands {
15441544 #[ arg( long, conflicts_with = "names" ) ]
15451545 all : bool ,
15461546
1547- /// Return after the gateway accepts the deletion request.
1548- #[ arg( long, conflicts_with = "timeout" ) ]
1549- no_wait : bool ,
1547+ /// Wait for each sandbox to reach terminal deletion.
1548+ ///
1549+ /// Pass `--wait=false` to return after the gateway accepts deletion.
1550+ #[ arg(
1551+ long,
1552+ default_value_t = true ,
1553+ default_missing_value = "true" ,
1554+ num_args = 0 ..=1 ,
1555+ action = clap:: ArgAction :: Set ,
1556+ ) ]
1557+ wait : bool ,
15501558
15511559 /// Positive seconds to wait for each sandbox to reach terminal deletion.
15521560 #[ arg( long, value_name = "SECONDS" , value_parser = clap:: value_parser!( u64 ) . range( 1 ..) ) ]
@@ -3217,7 +3225,7 @@ async fn run_async() -> Result<()> {
32173225 SandboxCommands :: Delete {
32183226 names,
32193227 all,
3220- no_wait ,
3228+ wait ,
32213229 timeout,
32223230 } => {
32233231 run:: sandbox_delete (
@@ -3228,7 +3236,7 @@ async fn run_async() -> Result<()> {
32283236 & tls,
32293237 & ctx. name ,
32303238 run:: SandboxDeleteOptions {
3231- no_wait ,
3239+ wait ,
32323240 timeout : timeout. map ( Duration :: from_secs) ,
32333241 } ,
32343242 )
@@ -4583,26 +4591,37 @@ mod tests {
45834591 }
45844592
45854593 #[ test]
4586- fn sandbox_delete_waits_by_default_and_accepts_async_options ( ) {
4594+ fn sandbox_delete_waits_by_default_and_accepts_wait_options ( ) {
45874595 let default_delete = Cli :: try_parse_from ( [ "openshell" , "sandbox" , "delete" , "demo" ] )
45884596 . expect ( "sandbox delete should parse" ) ;
45894597 assert ! ( matches!(
45904598 default_delete. command,
45914599 Some ( Commands :: Sandbox {
45924600 command: Some ( SandboxCommands :: Delete {
4593- no_wait : false ,
4601+ wait : true ,
45944602 timeout: None ,
45954603 ..
45964604 } )
45974605 } )
45984606 ) ) ;
45994607
4600- let no_wait = Cli :: try_parse_from ( [ "openshell" , "sandbox" , "delete" , "demo" , "--no-wait" ] )
4601- . expect ( "sandbox delete --no-wait should parse" ) ;
4608+ let async_delete =
4609+ Cli :: try_parse_from ( [ "openshell" , "sandbox" , "delete" , "demo" , "--wait=false" ] )
4610+ . expect ( "sandbox delete --wait=false should parse" ) ;
46024611 assert ! ( matches!(
4603- no_wait . command,
4612+ async_delete . command,
46044613 Some ( Commands :: Sandbox {
4605- command: Some ( SandboxCommands :: Delete { no_wait: true , .. } )
4614+ command: Some ( SandboxCommands :: Delete { wait: false , .. } )
4615+ } )
4616+ ) ) ;
4617+
4618+ let explicit_wait =
4619+ Cli :: try_parse_from ( [ "openshell" , "sandbox" , "delete" , "demo" , "--wait" ] )
4620+ . expect ( "sandbox delete --wait should parse" ) ;
4621+ assert ! ( matches!(
4622+ explicit_wait. command,
4623+ Some ( Commands :: Sandbox {
4624+ command: Some ( SandboxCommands :: Delete { wait: true , .. } )
46064625 } )
46074626 ) ) ;
46084627
@@ -4613,26 +4632,33 @@ mod tests {
46134632 timeout. command,
46144633 Some ( Commands :: Sandbox {
46154634 command: Some ( SandboxCommands :: Delete {
4616- no_wait : false ,
4635+ wait : true ,
46174636 timeout: Some ( 42 ) ,
46184637 ..
46194638 } )
46204639 } )
46214640 ) ) ;
46224641
4623- assert ! (
4624- Cli :: try_parse_from( [
4625- "openshell" ,
4626- "sandbox" ,
4627- "delete" ,
4628- "demo" ,
4629- "--no-wait" ,
4630- "--timeout" ,
4631- "42" ,
4632- ] )
4633- . is_err( ) ,
4634- "--no-wait and --timeout should conflict"
4635- ) ;
4642+ let asynchronous = Cli :: try_parse_from ( [
4643+ "openshell" ,
4644+ "sandbox" ,
4645+ "delete" ,
4646+ "demo" ,
4647+ "--wait=false" ,
4648+ "--timeout" ,
4649+ "42" ,
4650+ ] )
4651+ . expect ( "--wait=false should override the timeout" ) ;
4652+ assert ! ( matches!(
4653+ asynchronous. command,
4654+ Some ( Commands :: Sandbox {
4655+ command: Some ( SandboxCommands :: Delete {
4656+ wait: false ,
4657+ timeout: Some ( 42 ) ,
4658+ ..
4659+ } )
4660+ } )
4661+ ) ) ;
46364662 assert ! (
46374663 Cli :: try_parse_from( [ "openshell" , "sandbox" , "delete" , "demo" , "--timeout" , "0" , ] )
46384664 . is_err( ) ,
0 commit comments