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

Offen Anfängerfreundlich
#13 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
85/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
rust, tauri
Bereich
cli

Rechercherichtung

Die Argumentverarbeitung befindet sich in main() in crates/hidely-cli/src/main.rs, wo auch der USAGE-Text definiert ist. Lies nach, wie der aktuelle Code den Befehl abgleicht und wo er mit Exit-Code 2 beendet, und ergänze dann Zweige für help, --help, -h, --version und -V. Fertig ist es, wenn diese vier Varianten nach stdout ausgeben und mit Exit-Code 0 enden, die Version aus env!("CARGO_PKG_VERSION") stammt, USAGE beide Flags auflistet, unbekannte Befehle weiterhin mit Exit-Code 2 enden und der CLI-Abschnitt der README --help und --version erwähnt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.
Vorherrschende Sprache
Rust
Sterne
7
Forks
1
Ø Merge
6 Std. 34 Min.
Gemergte PRs (30 T.)
2

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus CodingRule/Hidely

Alle Issues in CodingRule/Hidely

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.