Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

WrappedJoin adds an empty line before an oversized first item

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

@GreedyC đang làm issue này rồi.

Từ ngày 2/10/2026.

  • #706 của @GreedyC — đang mở

Đá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
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu bằng cách xác định formatting.WrappedJoin và kiểm tra các nhánh overflow của nó, sau đó xem helptext._CreateAvailabilityLine kết hợp đầu ra của nó với việc cắt header như thế nào. Tái hiện ba ví dụ trong issue và bổ sung kiểm thử hồi quy cho một item quá lớn duy nhất, một item đầu tiên quá lớn và một separator rộng hơn chiều rộng khả dụng; hoàn thành khi không có dòng trống ở đầu và có wrapping cùng indentation như mong đợi.

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

Mô tả

Problem

When the first item is longer than the available width, WrappedJoin starts its output with an empty line. Its caller _CreateAvailabilityLine then combines that extra newline with the header slicing, shifting the first command one column to the right.

from fire import formatting, helptext

print(formatting.WrappedJoin(['long_command'], width=5))
# ['', 'long_command']; expected ['long_command']

print(formatting.WrappedJoin(['first', 'next'], width=5))
# ['', 'first |', 'next']; expected ['first |', 'next']

print(helptext._CreateAvailabilityLine('COMMANDS', ['long_command'], line_length=30))
# The command starts at column 26 rather than the requested items_indent=25.

The overflow branches append current_line even when it is still empty. I plan to only append a non-empty current line, keeping long items intact and preserving subsequent wrapping. Regression tests for a single long item, a long first item among multiple commands and an item whose separator exceeds the width fail on main.

Reproduced on macOS / Python 3.12.13. Checked existing issues and PRs for an overlapping WrappedJoin fix.

Investigated with Codex assistance.

Ngôn ngữ chính
Python
Star
28.2k
Fork
1.5k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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 google/python-fire

Tất cả issue của google/python-fire

Issue tương tự

Thêm issue về Python

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.