Coder Social home page Coder Social logo

Comments (4)

ewels avatar ewels commented on May 19, 2024 1

Ok, this should now be fixed. I think that the previous behaviour of only printing the first line was there because I was trying to mimic the click behaviour of showing a short help text for groups but then having longer help text when doing help on that specific subcommand.

Now it's slightly smarter and takes the first paragraph, according to double newlines. Single newlines are stripped (unless using Markdown, but then they're ignored).

from rich-click.

ewels avatar ewels commented on May 19, 2024

Thanks for reporting! Does this work as you'd expect with vanilla click output?

from rich-click.

apcamargo avatar apcamargo commented on May 19, 2024

Vanilla click doesn't allow command descriptions to be rendered over multiple lines, but it does support multi-line strings that use """.

Because the command descriptions are limited to a single line, click tries to be smart and only displays the text that comes before the first period:

def test_command(input, output, threads):
    """
    Let's build an almighty mountain. Maybe, just to play a little, we'll put a
    little tree here. Look around, look at what we have. Beauty is everywhere,
    you only have to look to see it. The only prerequisite is that it makes you
    happy. If it makes you happy then it's good. We don't have to be concerned
    about it. We just have to let it fall where it will. By now you should be
    quite happy about what's happening here.
    """
Commands:
  test-command  Let's build an almighty mountain.

If there's no period before the maximum width of the help dialog, it will use ellipsis:

def test_command(input, output, threads):
    """
    Let's build an almighty mountain Maybe, just to play a little, we'll put a
    little tree here. Look around, look at what we have. Beauty is everywhere,
    you only have to look to see it. The only prerequisite is that it makes you
    happy. If it makes you happy then it's good. We don't have to be concerned
    about it. We just have to let it fall where it will. By now you should be
    quite happy about what's happening here.
    """
Commands:
  test-command  Let's build an almighty mountain Maybe, just to play a...

My preference is the way rich-click renders when you use a single-line string (that is, shows the full description in the dialogue). If the goal is to stay as close to vanilla as possible, I think using ellipsis is fine (although I would use the true ellipsis character to save characters: ).

from rich-click.

ewels avatar ewels commented on May 19, 2024

Thanks 🙏🏻 I think displaying the full text is better too (might be scope for a config option there though I guess 🤔).

I'll take a look into fixing this ASAP.

from rich-click.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.