@@ -337,16 +337,18 @@ impl Platform {
337
337
///
338
338
/// # Examples
339
339
///
340
- /// ```
341
- /// let (prog, args) = parse_command("code .")?;
342
- /// assert_eq!(prog, "code");
343
- /// assert_eq!(args, ".");
340
+ /// ```no_run
341
+ /// # use wm::common::platform::Platform;
342
+ /// let (prog, args) = Platform::parse_command("code .")?;
343
+ /// assert_eq!(prog, "code");
344
+ /// assert_eq!(args, ".");
344
345
///
345
- /// let (prog, args) = parse_command(
346
- /// r#"C:\Program Files\Git\git-bash --cd=C:\Users\larsb\.glaze-wm"#,
347
- /// )?;
348
- /// assert_eq!(prog, r#"C:\Program Files\Git\git-bash"#);
349
- /// assert_eq!(args, r#"--cd=C:\Users\larsb\.glaze-wm"#);
346
+ /// let (prog, args) = Platform::parse_command(
347
+ /// r#"C:\Program Files\Git\git-bash --cd=C:\Users\larsb\.glaze-wm"#,
348
+ /// )?;
349
+ /// assert_eq!(prog, r#"C:\Program Files\Git\git-bash"#);
350
+ /// assert_eq!(args, r#"--cd=C:\Users\larsb\.glaze-wm"#);
351
+ /// # Ok::<(), anyhow::Error>(())
350
352
/// ```
351
353
pub fn parse_command ( command : & str ) -> anyhow:: Result < ( String , String ) > {
352
354
// Expand environment variables in the command string.
@@ -376,7 +378,7 @@ impl Platform {
376
378
} ;
377
379
378
380
let command_parts: Vec < & str > =
379
- expanded_command. trim ( ) . split_whitespace ( ) . collect ( ) ;
381
+ expanded_command. split_whitespace ( ) . collect ( ) ;
380
382
381
383
// If the command starts with double quotes, then the program name/path
382
384
// is wrapped in double quotes (e.g. `"C:\path\to\app.exe" --flag`).
@@ -435,8 +437,8 @@ impl Platform {
435
437
// causes issues where the pointer is dropped while `ShellExecuteExW`
436
438
// is using it. This is likely a `windows-rs` bug, and we can avoid
437
439
// it by keeping separate variables for the wide strings.
438
- let program_wide = to_wide ( & program) ;
439
- let args_wide = to_wide ( & args) ;
440
+ let program_wide = to_wide ( program) ;
441
+ let args_wide = to_wide ( args) ;
440
442
let home_dir_wide = to_wide ( & home_dir) ;
441
443
442
444
// Using the built-in `Command::new` function in Rust launches the
0 commit comments