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 摘要。