Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clap_complete_nushell: multi line comments break with verbatim_doc_comment #5164

Closed
2 tasks done
NyCodeGHG opened this issue Oct 8, 2023 · 1 comment
Closed
2 tasks done
Labels
A-completion Area: completion generator C-bug Category: Updating dependencies E-easy Call for participation: Experience needed to fix: Easy / not much

Comments

@NyCodeGHG
Copy link

Please complete the following tasks

Rust Version

rustc 1.71.0 (8ede3aae2 2023-07-12)

Clap Version

4.4.1 (clap_complete_nushell)

Minimal reproducible code

use std::io;
use clap::{Parser, CommandFactory};
use clap_complete::generate;
use clap_complete_nushell::Nushell;

fn main() {
    let mut cmd = Cli::command_for_update();
    generate(Nushell, &mut cmd, "foo", &mut io::stdout());
}

#[derive(Parser)]
struct Cli {
    /// Multiline
    /// comment.
    #[arg(long, verbatim_doc_comment)]
    foo: bool,
}

Steps to reproduce the bug with the above code

Run these steps in nushell:

  1. cargo run | save test.nu
  2. source test.nu

Actual Behaviour

nu cannot parse the resulting file

Error: nu::parser::parse_mismatch

  × Parse mismatch during operation.
   ╭─[/tmp/clap-reprod/test.nu:4:1]
 4 │     --foo                     # Multiline
 5 │ comment.
   · ────┬───
   ·     ╰── expected valid variable name for this parameter
 6 │     --help(-h)                # Print help
   ╰────

Expected Behaviour

nu should be able to parse the file

Additional Context

This only occurs when the comment contains a dot

Debug Output

[clap_builder::builder::command]Command::_build: name="clap-reprod"
[clap_builder::builder::command]Command::_propagate:clap-reprod
[clap_builder::builder::command]Command::_check_help_and_version:clap-reprod 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:clap-reprod
[clap_builder::builder::debug_asserts]Command::_debug_asserts
[clap_builder::builder::debug_asserts]Arg::_debug_asserts:foo
[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=[]
[ clap_builder::output::usage]Usage::get_required_usage_from: ret_val=[]
@NyCodeGHG NyCodeGHG added the C-bug Category: Updating dependencies label Oct 8, 2023
@epage epage added A-completion Area: completion generator E-easy Call for participation: Experience needed to fix: Easy / not much labels Oct 9, 2023
@poliorcetics
Copy link
Contributor

Should be closed by #5359 yesterday, sorry I missed this issue

@epage epage closed this as completed Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-completion Area: completion generator C-bug Category: Updating dependencies E-easy Call for participation: Experience needed to fix: Easy / not much
Projects
None yet
Development

No branches or pull requests

3 participants