Repository: clap-rs/clap (language: rust)

Issue:
Powershell completions not working with empty help string.
I came across a problem with the uutils coreutils package where the powershell completions didnt work, https://github.com/uutils/coreutils/issues/5933, and was directed here. I discovered this is because in the generated ps1 file the line [CompletionResuIt]::new('seq', 'seq', [CompletionResultType]::ParameterValue, '') exists, this line seems to cause the completions to fail and fall back on completing files, i also noticed this is not an issue and everything works as intended when adding something here, be it ' ' or anything else.
I dont know how this and i have never used clap so i dont know what to do to try to replicate it. But i can duplicate the issue in for example rustups completion by replacing it an empty string in one of the completion elements.


Discussion / hints:
Here's a minimal example as cargo script:
````rust
#!/usr/bin/env -S cargo +nightly -Zscript
```
[dependencies]
clap = "4.4.18"
clap_complete = "4.4.10"
```

use clap::Command;
use clap_complete::{generate, Shell::PowerShell};

fn main() {
    let mut cmd = Command::new("test").subcommand(Command::new("foo").about(""));
    generate(PowerShell, &mut cmd, "test", &mut std::io::stdout());
}
````

Upon further inspection, I do think we have to fix this in uutils as well, but I think `clap_complete` should be aware that an empty about breaks completion and fall back to something else.

Fix patch:
diff --git a/clap_complete/src/aot/shells/powershell.rs b/clap_complete/src/aot/shells/powershell.rs
index 13e4a61f351..d40c549ffe1 100644
--- a/clap_complete/src/aot/shells/powershell.rs
+++ b/clap_complete/src/aot/shells/powershell.rs
@@ -63,10 +63,13 @@ fn escape_string(string: &str) -> String {
 }
 
 fn escape_help<T: ToString>(help: Option<&StyledStr>, data: T) -> String {
-    match help {
-        Some(help) => escape_string(&help.to_string().replace('\n', " ")),
-        _ => data.to_string(),
+    if let Some(help) = help {
+        let help_str = help.to_string();
+        if !help_str.is_empty() {
+            return escape_string(&help_str.replace('\n', " "));
+        }
     }
+    data.to_string()
 }
 
 fn generate_inner(p: &Command, previous_command_name: &str) -> String {


Test patch: