hidely-cli: add a --json option to `list`

Offen Anfängerfreundlich
#3 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
84/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
json, rust
Bereich
cli

Rechercherichtung

Beginne in crates/hidely-cli/src/main.rs, wo der Befehl list und der Text USAGE stehen, lies dann list_windows(None) und den Typ WindowInfo in crates/hidely-core/src/windows.rs sowie display_affinity(hwnd) für das excluded-Flag. Füge serde_json zu crates/hidely-cli/Cargo.toml hinzu und sorge dafür, dass list --json pro Fenster ein Objekt mit den im Issue gezeigten Feldern ausgibt. Fertig, wenn cargo test --workspace und cargo build --workspace erfolgreich laufen, die normale list-Ausgabe unverändert ist und die Befehlsliste in der README das Flag erwähnt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

enhancement good first issue

hidely-cli list prints a table for people. Scripts would rather have JSON.

What to do

In crates/hidely-cli/src/main.rs, accept hidely-cli list --json and print a JSON array with one object per window:

[
  { "hwnd": "0x1a2b3c", "process": "notepad", "exe": "notepad.exe", "title": "notes.txt - Notepad", "excluded_from_capture": false }
]
  • The data is already there: list_windows(None) returns WindowInfo values (see windows.rs), and display_affinity(hwnd) says whether a window is excluded.
  • Add serde_json to crates/hidely-cli/Cargo.toml and build the output with serde_json::json!, so titles with quotes or backslashes are escaped correctly.
  • hidely-cli list without the flag must print exactly what it prints today.
  • Add the option to the USAGE text at the top of the file and to the command list in the README.

Done when

  • hidely-cli list --json prints valid JSON (try piping it into ConvertFrom-Json in PowerShell).
  • Plain hidely-cli list is unchanged.
  • cargo test --workspace and cargo build --workspace pass.
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.