File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2525,6 +2525,40 @@ fn launch_terminal_with_env(
25252525 // 创建并写入配置文件
25262526 write_claude_config ( & config_file, & env_vars) ?;
25272527
2528+ #[ cfg( target_os = "windows" ) ]
2529+ let parsed_custom_args = match custom_args. map ( |s| s. trim ( ) ) . filter ( |s| !s. is_empty ( ) ) {
2530+ Some ( s) => {
2531+ let mut args = Vec :: new ( ) ;
2532+ let mut current = String :: new ( ) ;
2533+ let mut in_quotes = false ;
2534+ let mut has_content = false ;
2535+ for c in s. chars ( ) {
2536+ if c == '"' {
2537+ in_quotes = !in_quotes;
2538+ has_content = true ;
2539+ } else if c. is_whitespace ( ) && !in_quotes {
2540+ if has_content {
2541+ args. push ( current. clone ( ) ) ;
2542+ current. clear ( ) ;
2543+ has_content = false ;
2544+ }
2545+ } else {
2546+ current. push ( c) ;
2547+ has_content = true ;
2548+ }
2549+ }
2550+ if in_quotes {
2551+ return Err ( "无法解析自定义 CLI 参数: 存在未闭合的引号,请检查您的输入并重试。" . to_string ( ) ) ;
2552+ }
2553+ if has_content {
2554+ args. push ( current) ;
2555+ }
2556+ args
2557+ }
2558+ None => Vec :: new ( ) ,
2559+ } ;
2560+
2561+ #[ cfg( not( target_os = "windows" ) ) ]
25282562 let parsed_custom_args = match custom_args. map ( |s| s. trim ( ) ) . filter ( |s| !s. is_empty ( ) ) {
25292563 Some ( s) => match shlex:: split ( s) {
25302564 Some ( args) => args,
You can’t perform that action at this time.
0 commit comments