Repository: clap-rs/clap (rust)

Issue:
Nushell completions should use `glob` type for paths
### Please complete the following tasks

- [X] I have searched the [discussions](https://github.com/clap-rs/clap/discussions)
- [x] I have searched the [open](https://github.com/clap-rs/clap/issues) and [rejected](https://github.com/clap-rs/clap/issues?q=is%3Aissue+label%3AS-wont-fix+is%3Aclosed) issues

### Rust Version

rustc 1.80.0 (051478957 2024-07-21) (Alpine Linux 1.80.0-r0)

### Clap Version

4.4.6 (4.5.3 for `clap_complete_nushell`)

### Minimal reproducible code

```rust
use clap::{CommandFactory, Parser};
use clap_complete::generate;
use clap_complete_nushell::Nushell;

use std::path::PathBuf;

#[derive(Parser)]
pub struct Options {
    path: PathBuf,

    rest: Vec<PathBuf>,
}

fn main() {
    let mut cmd = Options::command();
    generate(Nushell, &mut cmd, "sd", &mut std::io::stdout());
}
```


### Steps to reproduce the bug with the above code

`cargo run`

### Actual Behaviour

The following completion is generated:

```Nushell
module completions {

  export extern sd [
    path: string
    ...rest: string
    --help(-h)                # Print help
  ]

}

export use completions *
```

### Expected Behaviour

- Arguments with type `PathBuf` should have the `path` type in the completions, so that the native path completion works.
- Arguments with type `Vec<PathBuf>` should have the `glob` type, otherwise globbing breaks: `sd a *` will return an error, because path `*` doesn't exist. 

### Additional Context

_No response_

### Debug Output

```
[clap_builder::builder::command]Command::_build: name="compl"
[clap_builder::builder::command]Command::_propagate:compl
[clap_builder::builder::command]Command::_check_help_and_version:compl expand_help_tree=true
[clap_builder::builder::command]Command::long_help_exists
[clap_builder::builder::command]Command::_check_help_and_version: Building default --help
[clap_builder::builder::command]Command::_propagate_global_args:compl
[clap_builder::builder::debug_asserts]Command::_debug_asserts
[clap_builder::builder::debug_asserts]Arg::_debug_asserts:path
[clap_builder::builder::debug_asserts]Arg::_debug_asserts:rest
[clap_builder::builder::debug_asserts]Arg::_debug_asserts:help
[clap_builder::builder::debug_asserts]Command::_verify_positionals
[clap_builder::builder::command]Command::_build_bin_names
[ clap_builder::output::usage]Usage::get_required_usage_from: incls=[], matcher=false, incl_last=true
[ clap_builder::output::usage]Usage::get_required_usage_from: unrolled_reqs=["path"]
[ clap_builder::output::usage]Usage::get_required_usage_from:iter:"path" arg is_present=false
[ clap_builder::output::usage]Usage::get_required_usage_from: ret_val=[StyledStr("<PATH>")]
```

Pull request:
fix(nu): Set argument type based on `ValueHint`
fixes #5605 

- Modified `append_value_completion_and_help` to set argument type to `path` for `ValueHint::AnyPath`, `ValueHint::FilePath`, and `ValueHint::DirPath`, and to `string` for other `ValueHint`s.
- Updated test snapshots to reflect the changes in argument types.

<!--
Thanks for helping out!

Please link the appropriate issue from your PR.

If you don't have an issue, we'd recommend starting with one first so the PR can focus on the
implementation (unless its an obvious bug or documentation fix that will have
little conversation).
-->


Patch:
diff --git a/clap_complete_nushell/src/lib.rs b/clap_complete_nushell/src/lib.rs
index e7f064e2..b95a835e 100644
--- a/clap_complete_nushell/src/lib.rs
+++ b/clap_complete_nushell/src/lib.rs
@@ -23,6 +23,7 @@
 #![warn(clippy::print_stdout)]
 
 use clap::builder::StyledStr;
+use clap::ValueHint;
 use clap::{builder::PossibleValue, Arg, ArgAction, Command};
 use clap_complete::Generator;
 
@@ -65,7 +66,23 @@ fn append_value_completion_and_help(
         .unwrap_or(false);
 
     if takes_values {
-        s.push_str(": string");
+        let nu_type = match arg.get_value_hint() {
+            ValueHint::Unknown => "string",
+            ValueHint::Other => "string",
+            ValueHint::AnyPath => "path",
+            ValueHint::FilePath => "path",
+            ValueHint::DirPath => "path",
+            ValueHint::ExecutablePath => "path",
+            ValueHint::CommandName => "string",
+            ValueHint::CommandString => "string",
+            ValueHint::CommandWithArguments => "string",
+            ValueHint::Username => "string",
+            ValueHint::Hostname => "string",
+            ValueHint::Url => "string",
+            ValueHint::EmailAddress => "string",
+            _ => "string",
+        };
+        s.push_str(format!(": {nu_type}").as_str());
 
         if !possible_values.is_empty() {
             s.push_str(format!(r#"@"nu-complete {} {}""#, name, arg.get_id()).as_str());


Test patch:
diff --git a/clap_complete_nushell/tests/snapshots/feature_sample.nu b/clap_complete_nushell/tests/snapshots/feature_sample.nu
index 78e772bc..eb081b9b 100644
--- a/clap_complete_nushell/tests/snapshots/feature_sample.nu
+++ b/clap_complete_nushell/tests/snapshots/feature_sample.nu
@@ -6,7 +6,7 @@ module completions {
 
   # Tests completions
   export extern my-app [
-    file?: string             # some input file
+    file?: path               # some input file
     --config(-c)              # some config file with another line
     --conf                    # some config file with another line
     -C                        # some config file with another line
diff --git a/clap_complete_nushell/tests/snapshots/home/static/test/nu/.config/nushell/completions/test.nu b/clap_complete_nushell/tests/snapshots/home/static/test/nu/.config/nushell/completions/test.nu
index 03c5cd6b..ac1e050f 100644
--- a/clap_complete_nushell/tests/snapshots/home/static/test/nu/.config/nushell/completions/test.nu
+++ b/clap_complete_nushell/tests/snapshots/home/static/test/nu/.config/nushell/completions/test.nu
@@ -178,10 +178,10 @@ module completions {
     --choice: string@"nu-complete test hint choice"
     --unknown: string
     --other: string
-    --path(-p): string
-    --file(-f): string
-    --dir(-d): string
-    --exe(-e): string
+    --path(-p): path
+    --file(-f): path
+    --dir(-d): path
+    --exe(-e): path
     --cmd-name: string
     --cmd(-c): string
     command_with_args?: string
diff --git a/clap_complete_nushell/tests/snapshots/special_commands.nu b/clap_complete_nushell/tests/snapshots/special_commands.nu
index f74a3c86..0551531b 100644
--- a/clap_complete_nushell/tests/snapshots/special_commands.nu
+++ b/clap_complete_nushell/tests/snapshots/special_commands.nu
@@ -6,7 +6,7 @@ module completions {
 
   # Tests completions
   export extern my-app [
-    file?: string             # some input file
+    file?: path               # some input file
     --config(-c)              # some config file with another line
     --conf                    # some config file with another line
     -C                        # some config file with another line
diff --git a/clap_complete_nushell/tests/snapshots/sub_subcommands.nu b/clap_complete_nushell/tests/snapshots/sub_subcommands.nu
index 7b0570f8..2f56ca6d 100644
--- a/clap_complete_nushell/tests/snapshots/sub_subcommands.nu
+++ b/clap_complete_nushell/tests/snapshots/sub_subcommands.nu
@@ -6,7 +6,7 @@ module completions {
 
   # Tests completions
   export extern my-app [
-    file?: string             # some input file
+    file?: path               # some input file
     --config(-c)              # some config file with another line
     --conf                    # some config file with another line
     -C                        # some config file with another line
diff --git a/clap_complete_nushell/tests/snapshots/value_hint.nu b/clap_complete_nushell/tests/snapshots/value_hint.nu
index 2cc0b5ab..f27849a5 100644
--- a/clap_complete_nushell/tests/snapshots/value_hint.nu
+++ b/clap_complete_nushell/tests/snapshots/value_hint.nu
@@ -8,10 +8,10 @@ module completions {
     --choice: string@"nu-complete my-app choice"
     --unknown: string
     --other: string
-    --path(-p): string
-    --file(-f): string
-    --dir(-d): string
-    --exe(-e): string
+    --path(-p): path
+    --file(-f): path
+    --dir(-d): path
+    --exe(-e): path
     --cmd-name: string
     --cmd(-c): string
     command_with_args?: string