Improve text wrapping

オープン
#3,016 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python
領域
cli

調査の方向性

リンクされたドキュメントで説明されている Click のテキスト折り返し動作から始め、コンソール幅を 60 にして例を再現します。ヘルプテキストのフォーマット処理のエントリポイントを追跡し、改行を保持しながらコンソール幅に合わせて折り返すことを確認するカバレッジを追加します。長い行がはみ出さず、単語が予期せず分割されなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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)

主要言語
Python
スター
17.8k
フォーク
3.3k
平均マージ
3日 3時間
マージ済み PR(30日)
13

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pallets/click のほかの issue

pallets/click の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。