Improve text wrapping

Đang mở
#3,016 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

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

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu với hành vi ngắt dòng văn bản của Click được mô tả trong tài liệu được liên kết và tái hiện các ví dụ ở chiều rộng console là 60. Truy vết điểm vào của việc định dạng văn bản trợ giúp và bổ sung coverage để giữ nguyên các ký tự xuống dòng trong khi vẫn ngắt dòng theo chiều rộng console; hoàn thành khi các dòng dài không còn tràn ra ngoài hoặc tách từ ngoài dự kiến.

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

Mô tả

help output

Currently click has 2 modes to display a help text:

  1. Word-wrap the entire blob, and remove all other whitespaces
  2. Preserve newlines, but disable word-wrapping
  1. with a console width of 60, visualized with the *:
************************************************************
Usage: click_wrapping.py [OPTIONS]

Options:
  --test [value1|value2]  Example text to show word
                          wrapping. 'Value1' - short
                          comment. 'Value2' - A longer
                          comment that should wrap to the
                          next line.
  --help                  Show this message and exit.
************************************************************
  1. with a console width of 60, visualized with the *:
************************************************************
Usage: click_wrapping.py [OPTIONS]

Options:
  --test [value1|value2]  Example text to show word wrapping.
                          'Value1' - short comment.
                          'Value2' - A longer comment that should wrap to the next line.
  --help                  Show this message and exit.
************************************************************

The 2nd option is slightly problematic, because on an actual console with width of 60, it looks like this:

************************************************************
Usage: click_wrapping.py [OPTIONS]

Options:
  --test [value1|value2]  Example text to show word wrapping
.
                          'Value1' - short comment.
                          'Value2' - A longer comment that s
hould wrap to the next line.
  --help                  Show this message and exit.
************************************************************

And that should probably be more along the lines of:

************************************************************
Usage: click_wrapping.py [OPTIONS]

Options:
  --test [value1|value2]  Example text to show word
                          wrapping.
                          'Value1' - short comment.
                          'Value2' - A longer comment that
                          should wrap to the next line.
  --help                  Show this message and exit.
************************************************************

Would a PR to fix this be accepted?
(As in, preserve newlines but still wrap on the console width)

Ngôn ngữ chính
Python
Star
17.8k
Fork
3.3k
Merge trung bình
3 ngày 3 giờ
Pull request đã merge (30 ngày)
13

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

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

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 pallets/click

Tất cả issue của pallets/click

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.