有什么办法让我们在“鼓掌”的帮助信息中出现断线吗?
我尝试了多行注释,也尝试在混合中插入\n。但这两样都不管用。
#[derive(Parser, Debug)]
#[clap(author, version, about)]
struct Args {
/// The input filename.\n
/// Hello world!
#[clap(short, long, value_parser)]
input: String,
}输出:
USAGE:
ascii_tree --input <INPUT>
OPTIONS:
-h, --help Print help information
-i, --input <INPUT> The input filename.\n Hello world!
-V, --version Print version information是否有办法实现以下目标?
USAGE:
ascii_tree --input <INPUT>
OPTIONS:
-h, --help Print help information
-i, --input <INPUT> The input filename.
Hello world!
-V, --version Print version information发布于 2022-07-20 11:07:28
我知道有两个选择。使第二行只包含///,或使用verbatim_doc_comment
#[derive(Parser, Debug)]
struct Args {
/// Name of the person to greet
///
/// Has a multi-line help.
#[clap(short, long)]
name: String,
/// Number of times to greet
/// Use the verbatim arg
#[clap(short, long, verbatim_doc_comment)]
count: u8,
}发布于 2022-07-20 11:17:34
您可以添加verbatim_doc_comment选项:
#[derive(Parser, Debug)]
#[clap(author, version, about)]
struct Args {
/// The input filename.
/// Hello world!
#[clap(short, long, value_parser, verbatim_doc_comment)]
input: String,
}USAGE:
ascii_tree --input <INPUT>
OPTIONS:
-h, --help Print help information
-i, --input <INPUT> The input filename.
Hello world!
-V, --version Print version information似乎没有它,Rust只通过双换行符识别段落。
https://stackoverflow.com/questions/73050387
复制相似问题