一些rust clap库的笔记

小试牛刀 clap是rust下面的一款命令行解析的库,下面是一些使用的笔记。 在Cargo.toml中添加下面的依赖 [dependencies] clap = {version = "4",features = ["derive"]} 对应feature的作用如下: 默认特性 std: Not Currently Used. Placeholder for supporting no_std environments in a backwards compatible manner. color: Turns on colored error messages. help: Auto-generate help output usage: Auto-generate usage error-context: Include contextual information for errors (which arg failed, etc) suggestions: Turns on the Did you mean '--myoption'? feature for when users make typos. 可选特性 deprecated: Guided experience to prepare for next breaking release (at different stages of development, this may become default) derive: Enables the custom derive (i....

April 19, 2024 · 5 min · czyt