question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prevent rewrapping with `\b`

See original GitHub issue

Hi @ewels, rich-click is an awesome package and I love that it’s a drop-in replacement for click. However, I’m running into a small issue with rewrapping. click uses the \b flag to prevent rewrapping for a paragraph, which allows you to preserve newlines in a command’s help. rich-click doesn’t seem to support that flag and removes newlines.

Say you have a command foo:

@click.command()
def foo():
    """This is a command.

    \b
    Examples
        $ foo
        $ foo bar
    """
    return

Here’s the output of foo --help using just click:

image

With rich-click, the newlines are lost.

image

Using Markdown instead might be an alternative, but would require rewriting docstrings and would break compatibility with click. Any chance of support being added for \b in rich-click?

Thanks!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
blagcommented, Jun 8, 2022

I thought I had already responded to this but I don’t see my comment here so I guess not.

The issue I had was that I was using rich-click version 1.3.0, and support for this was released in rich-click version 1.3.1.

Once I updated to rich-click 1.3.1, everything works perfectly, as expected.

Thank you for your help and apologies for not checking that before commenting. This package is seriously awesome! 😄

1reaction
aazuspancommented, Mar 1, 2022

Works perfectly. Thanks for such a quick fix!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to avoid wrapping text in CSS - html - Stack Overflow
It wraps because the element has a fixed width set on it and the text ”LOW FEES” does not fit into that width....
Read more >
How to prevent text from wrapping in a Word document
Next, delete the space between the comma and Ph.D and press Ctrl+Shift+Spacebar. As you can see in Figure B Word couldn't keep the...
Read more >
How to prevent line-wrapping in listing block? - Google Groups
Dan Allen. The CSS is responsible for controlling whether wrapping happens or not in a listing / literal block. In the default AsciiDoc...
Read more >
How to prevent text in a table cell from wrapping using CSS?
The task is to prevent the text in a table cell from wrapping using CSS. To achieve this we use white-space property of...
Read more >
How to disable line wrap in a terminal? - Unix Stack Exchange
You can temporarily disable line wrapping by entering this command:: tput rmam. To restore line wrapping use this command: tput smam.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found