- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有没有办法让我们在 clap 的帮助消息中换行?
我尝试了多行注释,还尝试在混合中插入 \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
最佳答案
我知道有两个选择。让第二行只包含///
,或者使用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,
}
关于rust - 如何使用 Clap 提供多行帮助消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73050387/
有没有办法让我们在 clap 的帮助消息中换行? 我尝试了多行注释,还尝试在混合中插入 \n。但两者都不起作用。 #[derive(Parser, Debug)] #[clap(author, ver
我想使用 clap derive API 来解析 Ipv4Addr。 #![allow(unused)] use clap; // 3.1.6 use clap::Parser; use std::n
我正在使用 Clap,我的 YAML 文件包含以下内容: args: - DIRECTORY help: one or more directories required: true
我正在构建一个可以调用其他底层程序的 CLI,这些程序有自己的选项和参数。我希望能够通过 CLI 将这些选项传递给程序。 $ cli --program [PROGRAM] --programOpts
我正在使用 clap,但在尝试解析参数时出现意外行为。 我的命令行工具应该像这样工作 foo -u 例如: foo -u jack echo s foo -u paul ls -al 我需要获取诸
这是一个例子: extern crate clap; use clap::{Arg, App}; fn main() { let args = App::new("test") .arg(Ar
即使阅读了关于引用所有权和借用的章节,我仍然无法理解以下代码中的某些内容,这实际上阻止了我从 clap::App 调用多个方法! extern crate clap; use clap::App; f
假设我有以下命令行: ./app foo bar baz 我想从中取出这个数组: ["foo", "bar", "baz"] 考虑到位置参数可以任意计数,有没有办法在 clap 中做到这一点? 最佳答
作为我的 CLI 工具的一部分,我有一个 clap::Arg取多个值,表示 (x, y)协调。我希望使用能够将值作为 -p/--position 1 0 传递 .arg( clap::Arg:
我正在使用 Clap我正在努力使子命令可以为参数取多个值。我追求的界面是: just use repo [files] 一个例子: just use radar/dot-files gitaliase
我正在使用 the Clap crate用于解析命令行参数。我定义了一个子命令 ls那应该列出文件。 Clap 还定义了一个 help显示有关应用程序及其使用情况的信息的子命令。 如果没有提供命令,则
我目前正在研究 Rust port证券tool .根据 Rust 的指南,我想将核心库隔离到它自己的箱子中,这样我们就可以创建与核心库交互的各种工具(CLI、API、流等),而无需将它们耦合在一起。
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 去年关闭。 Improve th
我有一个使用 Clap 的程序 foo处理命令参数解析。 foo 调用另一个程序 bar。最近,我决定 foo 的用户如果愿意,应该能够将参数传递给 bar。我向 Clap 添加了 bar 命令: l
我正在尝试在 Clap 和 YAML 的帮助下用 Rust 编写 CLI。我的输入将需要一个参数(文件路径)和标志之一 -s、-r 或 -g。标志 -s 和 -r 将需要两个标志之一 -t 和 -m,
问题 我有一个采用不同选项的命令,这些选项的相对顺序对于命令的语义很重要。例如,在 command --config A --some-option --config-file B --random-
我遇到了与 Is there any straightforward way for Clap to display help when no command is provided? 相同的问题,但
我正在学习 Rust 并尝试找到类似实用程序的工具(是的,另一个),我正在使用 clap 并尝试支持程序参数的命令行和配置文件(这与 clap yml 文件无关) . 我正在尝试解析命令,如果没有命令
我有一个鼓掌App像这样: let m = App::new("test") .arg( Arg::with_name("INPUT") .help("
clap crate 为 -h 选项实现了内置行为,但它似乎没有为 -? 做同样的事情。有没有办法告诉它这样做? 最佳答案 我在 clap repository 上开了一个问题.作者/主要贡献者已在那
我是一名优秀的程序员,十分优秀!