hidely-cli: add --help and --version

未关闭 适合新手
#13 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
85/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust, tauri
领域
cli

调研方向

参数处理逻辑位于 crates/hidely-cli/src/main.rs 中的 main(),USAGE 文本也在该文件中定义。请阅读当前代码如何匹配命令以及在哪里以退出码 2 退出,然后为 help、--help、-h、--version 和 -V 添加分支。完成的标准是:这四个参数输出到 stdout 并以退出码 0 结束,版本号来自 env!("CARGO_PKG_VERSION"),USAGE 列出两个标志,未知命令仍以退出码 2 退出,并且 README 的 CLI 部分提到 --help 和 --version。

由索引模型根据 Issue 内容生成。

描述

enhancement good first issue

hidely-cli prints its usage only when it doesn't understand the command, and then exits with code 2, as an error. Asking for help on purpose shouldn't look like a mistake, and there's no way to see which version you have.

This is a good first Rust contribution: one file, no Windows API knowledge needed.

What to do

In main() in crates/hidely-cli/src/main.rs:

  • hidely-cli help, hidely-cli --help and hidely-cli -h print USAGE to stdout and exit with ExitCode::SUCCESS.
  • hidely-cli --version and hidely-cli -V print hidely-cli 0.3.1, taking the number from env!("CARGO_PKG_VERSION") so it never has to be updated by hand.
  • Add both to the USAGE text.
  • Running it with no arguments, or with a command it doesn't know, keeps the current behaviour (usage on stderr, exit code 2).

Done when

  • The four cases above behave as described.
  • The CLI section of the README mentions --help and --version.
主要语言
Rust
星标
7
派生
1
平均合并
6 小时 34 分钟
30 天内合并 PR
2

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

CodingRule/Hidely 的其他 Issue

查看 CodingRule/Hidely 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。