@@ -1472,6 +1472,10 @@ enum SandboxCommands {
14721472 /// Outside a Git work tree, uploads proceed unfiltered with a warning.
14731473 /// Filtering errors or empty selections stop the upload; use
14741474 /// `--no-git-ignore` to intentionally upload everything.
1475+ ///
1476+ /// Cannot be combined with a trailing command, because uploads finish
1477+ /// after the main process starts. Create the sandbox without a command,
1478+ /// then run the workload with `sandbox exec`.
14751479 #[ arg(
14761480 long,
14771481 value_hint = ValueHint :: AnyPath ,
@@ -4878,6 +4882,35 @@ mod tests {
48784882 ) ;
48794883 }
48804884
4885+ #[ test]
4886+ fn sandbox_create_upload_conflicts_with_command_and_help_says_so ( ) {
4887+ let err = Cli :: try_parse_from ( [
4888+ "openshell" ,
4889+ "sandbox" ,
4890+ "create" ,
4891+ "--upload" ,
4892+ "." ,
4893+ "--" ,
4894+ "true" ,
4895+ ] )
4896+ . expect_err ( "--upload with a trailing command should be rejected" ) ;
4897+ assert_eq ! ( err. kind( ) , clap:: error:: ErrorKind :: ArgumentConflict ) ;
4898+
4899+ let cmd = Cli :: command ( ) ;
4900+ let create = cmd
4901+ . find_subcommand ( "sandbox" )
4902+ . and_then ( |c| c. find_subcommand ( "create" ) )
4903+ . expect ( "missing sandbox create subcommand" ) ;
4904+ let help = create
4905+ . get_arguments ( )
4906+ . find ( |a| a. get_id ( ) == "upload" )
4907+ . and_then ( |a| a. get_long_help ( ) )
4908+ . expect ( "--upload has long help" )
4909+ . to_string ( ) ;
4910+ assert ! ( help. contains( "Cannot be combined with a trailing command" ) ) ;
4911+ assert ! ( help. contains( "sandbox exec" ) ) ;
4912+ }
4913+
48814914 #[ test]
48824915 fn sandbox_create_no_git_ignore_requires_upload ( ) {
48834916 let result = Cli :: try_parse_from ( [ "openshell" , "sandbox" , "create" , "--no-git-ignore" ] ) ;
0 commit comments