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

Đang mở Phù hợp với người mới
#3 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
84/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
json, rust
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu từ crates/hidely-cli/src/main.rs, nơi có lệnh list và văn bản USAGE, sau đó đọc list_windows(None) và kiểu WindowInfo trong crates/hidely-core/src/windows.rs, cùng với display_affinity(hwnd) cho cờ excluded. Thêm serde_json vào crates/hidely-cli/Cargo.toml và làm cho list --json xuất một đối tượng cho mỗi cửa sổ với các trường đã nêu trong issue. Hoàn thành khi cargo test --workspace và cargo build --workspace đều thành công, đầu ra list thông thường không thay đổi, và danh sách lệnh trong README có nhắc đến cờ đó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
Rust
Star
7
Fork
1
Merge trung bình
6 giờ 34 phút
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của CodingRule/Hidely

Tất cả issue của CodingRule/Hidely

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.