Format click help output nicely with rich.

Related tags

CLI Tools rich-click
Overview

rich-click

Format click help output nicely with Rich.

  • Click is a "Python package for creating beautiful command line interfaces".
  • Rich is a "Python library for rich text and beautiful formatting in the terminal".

The intention of rich-click is to provide attractive help output from click, formatted with rich, with minimal customisation required.

Screenshots

Native click help With rich-click

Installation

You can install rich-click from the Python Package Index (PyPI) with pip or equivalent.

python -m pip install rich-click

Usage

There are two main ways to set up rich-click formatting for your tool. Which you choose will depend on your use-case and your personal disposition:

The path of least typing

Monkey patching is probably bad and you should only use this method if you are a Responsible Developer. It's also good if you're lazy, as it requires very little typing. In fact, the whole thing can be done in just four lines:

import click
import rich_click
click.Group.format_help = rich_click.rich_format_help
click.Command.format_help = rich_click.rich_format_help

This overwrites the default click methods with those from the rich-click package. As such, no other changes are needed - just continue to use click as you would normally and it will use these custom methods to print your help output.

The good and proper way

If using monkey-patching in your project makes your palms sweaty and your pulse race, then you'll be pleased to know that you can also use rich-click in a nicely declarative and verbose manner:

import click
import rich_click

class RichClickGroup(click.Group):
    def format_help(self, ctx, formatter):
        rich_click.rich_format_help(self, ctx, formatter)
class RichClickCommand(click.Command):
    def format_help(self, ctx, formatter):
        rich_click.rich_format_help(self, ctx, formatter)

@click.group(cls=RichClickGroup)
@click.option('--debug/--no-debug', default=False)
def cli(debug):
    click.echo(f"Debug mode is {'on' if debug else 'off'}")

@cli.command(cls=RichClickCommand)
def sync():
    click.echo('Syncing')

(example based on the click docs)

Here we are making new Group and Command child classes that are based on click. We define our custom format_help() functions and then tell click to to use these classes with the cls argument.

Customisation

There isn't really much you can customise yet, but this is planned. I'm thinking:

  • Colours
  • Whether to print positional arguments or not
    • Could maybe provide custom args to give help text to these
  • The ability to break up commands and options into multiple named panels

Contributing

Contributions and suggestions for new features are welcome, as are bug reports! Please create a new issue or better still, dive right in with a pull-request.

Credits

This package was put together hastily by Phil Ewels (@ewels), but the hard work was really done by Will McGugan (@willmcgugan) who not only is the author of Rich but also wrote the original code that this package is based on.

Comments
  • `py.typed` not getting distributed

    `py.typed` not getting distributed

    It seems that the py.typed file is not getting distributed, so mypy is not recognizing installed rich-click as being typed. I think you need to explicitly add it to package_data (options.package_data in setup.cfg).

    opened by zmoon 11
  • Prevent rewrapping with `\b`

    Prevent rewrapping with `\b`

    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!

    missing click functionality 
    opened by aazuspan 9
  • Add pre-commit

    Add pre-commit

    Added the following tools to pre-commit:

    • iSort (import formatter)
    • Black (general formatter)
    • Flake8 (style checker)
    • Mypy (type checker)

    Furthermore, modified the README.md to contain new instructions.

    Two more things are left to do:

    • [x] Run pre-commit on the entire codebase.
    • [ ] Add item to changelog.
    opened by Jorricks 8
  • Add support for Typer

    Add support for Typer

    This looks great! Thank you for sharing this.

    I tried using the import in a Typer project and (unsurprisingly) it didn't work. Even if there's no official code support for using this with Typer, some docs would be super helpful since I would love to use it for my CLI.

    new feature 
    opened by Benjamin-Lee 8
  • Rich-click does not format nested commands

    Rich-click does not format nested commands

    Nested commands are not formatted at all. Because I couldn't get my script to work correctly I tried the simple example script. I get:

    $ python rich_click_ex1.py
    
     Usage: rich_click_ex1.py [OPTIONS] COMMAND [ARGS]...
    
     My amazing tool does all the things.
     This is a minimal example based on documentation from the 'click' package.
     You can try using --help at the top level and also for specific group
     subcommands.
    
    ╭─ Options ────────────────────────────────────────────────────────────────────╮
    │ --debug/--no-debug  -d/-n    Enable debug mode. Newlines are removed by      │
    │                              default.                                        │
    │                              Double newlines are preserved.                  │
    │ --help                       Show this message and exit.                     │
    ╰──────────────────────────────────────────────────────────────────────────────╯
    ╭─ Commands ───────────────────────────────────────────────────────────────────╮
    │ download  Optionally use short-help for the group help text                  │
    │ sync      Synchronise all your files between two places. Example command     │
    │           that doesn't do much except print to the terminal.                 │
    ╰──────────────────────────────────────────────────────────────────────────────╯
    

    This works as advertised. However:

    $ python rich_click_ex1.py sync --help
    Debug mode is off
    Usage: rich_click_ex1.py sync [OPTIONS]
    
      Synchronise all your files between two places. Example command that
      doesn't do much except print to the terminal.
    
    Options:
      --type TEXT  Type of file to sync  [default: files; required]
      --all
      --help       Show this message and exit.
    

    This does not work as advertised. Am I missing something? Should the example script be updated or is this a bug?

    opened by davidfokkema 7
  • Allow adding extra lines to separate commands/parameters

    Allow adding extra lines to separate commands/parameters

    This one might be niche, not that useful, and (maybe) annoying to implement. I decided to post it here anyway.

    I noticed that when I have several commands, the help dialogue looks very busy and difficult to read:

    ╭─ Modules ────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │  download-database          Download the latest version of Genomad's database and save it in the DESTINATION         │
    │                             directory.                                                                               │
    │  annotate                   Predict the genes in the INPUT file (FASTA format), annotate them using Genomad's        │
    │                             markers (located in the DATABASE directory), and write the results to the OUTPUT         │
    │                             directory.                                                                               │
    │  find-proviruses            Find integrated viruses within the sequences in INPUT file using the Genomad markers     │
    │                             (located in the DATABASE directory) and write the results to the OUTPUT directory. This  │
    │                             command depends on the data generated by the annotate module.                            │
    │  marker-classification      Classify the sequences in the INPUT file (FASTA format) based on the presence of         │
    │                             Genomad markers (located in the DATABASE directory) and write the results to the OUTPUT  │
    │                             directory. This command depends on the data generated by the annotate module.            │
    │  nn-classification          Classify the sequences in the INPUT file (FASTA format) using the Genomad neural         │
    │                             network and write the results to the OUTPUT directory.                                   │
    │  aggregated-classification  Aggregate the results of the marker-classification and nn-classification modules to      │
    │                             classify the sequences in the INPUT file (FASTA format) and write the results to the     │
    │                             OUTPUT directory.                                                                        │
    │  score-calibration          Performs score calibration of the sequences in the INPUT file (FASTA format) using the   │
    │                             batch correction method and write the results to the OUTPUT directory. This module       │
    │                             requires that at least one of the classification modules was classified previously       │
    │                             (marker-classification, nn-classification, aggregated-classification).                   │
    │  summary                    Generates a classification report file for the sequences in the INPUT file (FASTA        │
    │                             format) and write it to the OUTPUT directory.                                            │
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    

    If I add an additional line to separate the commands, the dialogue looks much better.

    ╭─ Modules ────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │  download-database          Download the latest version of Genomad's database and save it in the DESTINATION         │
    │                             directory.                                                                               │
    │                                                                                                                      │
    │  annotate                   Predict the genes in the INPUT file (FASTA format), annotate them using Genomad's        │
    │                             markers (located in the DATABASE directory), and write the results to the OUTPUT         │
    │                             directory.                                                                               │
    │                                                                                                                      │
    │  find-proviruses            Find integrated viruses within the sequences in INPUT file using the Genomad markers     │
    │                             (located in the DATABASE directory) and write the results to the OUTPUT directory. This  │
    │                             command depends on the data generated by the annotate module.                            │
    │                                                                                                                      │
    │  marker-classification      Classify the sequences in the INPUT file (FASTA format) based on the presence of         │
    │                             Genomad markers (located in the DATABASE directory) and write the results to the OUTPUT  │
    │                             directory. This command depends on the data generated by the annotate module.            │
    │                                                                                                                      │
    │  nn-classification          Classify the sequences in the INPUT file (FASTA format) using the Genomad neural         │
    │                             network and write the results to the OUTPUT directory.                                   │
    │                                                                                                                      │
    │  aggregated-classification  Aggregate the results of the marker-classification and nn-classification modules to      │
    │                             classify the sequences in the INPUT file (FASTA format) and write the results to the     │
    │                             OUTPUT directory.                                                                        │
    │                                                                                                                      │
    │  score-calibration          Performs score calibration of the sequences in the INPUT file (FASTA format) using the   │
    │                             batch correction method and write the results to the OUTPUT directory. This module       │
    │                             requires that at least one of the classification modules was classified previously       │
    │                             (marker-classification, nn-classification, aggregated-classification).                   │
    │                                                                                                                      │
    │  summary                    Generates a classification report file for the sequences in the INPUT file (FASTA        │
    │                             format) and write it to the OUTPUT directory.                                            │
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    
    new feature style 
    opened by apcamargo 7
  • Return value from Typer function is printed only when installed

    Return value from Typer function is printed only when installed

    I apologize in advance for how obscure this bug is.

    I'll start by taking the simple Typer demo and modifying it to have download return a string:

    
    import rich_click.typer as typer
    
    app = typer.Typer()
    
    @app.command()
    def sync(
        type: str = typer.Option("files", help="Type of file to sync"),
        all: bool = typer.Option(False, help="Sync all the things?"),
    ):
        print("Syncing")
    
    
    @app.command()
    def download(all: bool = typer.Option(False, help="Get everything")):
        return "Shouldn't appear" # <-- RETURNS A STRING NOW
    
    
    if __name__ == "__main__":
        app()
    

    When run directly, everything is normal:

    $ python vdsearch/test.py download
    $
    

    Now let's pip install -e . with testy mapped to test:app

    $ testy download
    Shouldn't appear
    $
    

    I've gotten around this bug by defining wrapper functions for my functions but it would be nice to get to the bottom of what's going on.

    bug help wanted 
    opened by Benjamin-Lee 7
  • `rich_cli` does not properly clean indentations for `click >= 8.1.0`

    `rich_cli` does not properly clean indentations for `click >= 8.1.0`

    rich_click is not cleaning indentations if click version is ≥ 8.10. The cause is probably this change in the backend.

    This code:

    def cli():
        """
        Foo: bar
    
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
        tempor incididunt ut labore et dolore magna aliqua. Pellentesque habitant
        morbi tristique senectus. Leo a diam sollicitudin tempor.
        """
    

    Is generating this:

     Foo: bar
     Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod     tempor incididunt ut
     labore et dolore magna aliqua. Pellentesque habitant     morbi tristique senectus. Leo a diam
     sollicitudin tempor.
    

    Instead of this:

     Foo: bar
     Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore
     et dolore magna aliqua. Pellentesque habitant morbi tristique senectus. Leo a diam sollicitudin
     tempor.
    
    bug high priority 
    opened by apcamargo 7
  • `rich_click.rich_click` does not show up in auto-complete in VSCode

    `rich_click.rich_click` does not show up in auto-complete in VSCode

    Not sure if this is an issue with my own VSCode setup, but for some reason, I am not getting proper autocompletions for rich_click on lines after the import. As I type the import I do get the expected completions, but after that, when using the imported module, they don't show up.

    image

    image

    Because the completion for rich_click.r did not show rich_click, I was confused for a moment.

    opened by taranlu-houzz 6
  • Move RichGroup and RichCommand out of rich_click.py

    Move RichGroup and RichCommand out of rich_click.py

    First of a couple refactorings that are coming up. This refactoring:

    • Removes local imports. It's generally more preferred to use absolute imports.
    • I moved the classes out of rich_click.py. This made the rich_click.py unnecessarily large..
    • Moved the creation of the console into a function, as it's used all over the place.

    I think to tune this file down more, we might consider moving all rich specific tools to a file called rich_utils and moving the click items into click_utils.

    opened by Jorricks 6
  • Command `short_help` is ignored

    Command `short_help` is ignored

    Hi @ewels, I came across another discrepancy between click and rich-click that's giving me a little trouble: how command short help is handled.

    click generates short help from the first sentence of the command's help unless short_help is explicitly passed to the command, in which case that will be used. rich-click seems to use the first paragraph instead, and you can't overwrite it using short_help.

    Here's a minimum reproducible example using rich-click==1.2.0.

    @click.group()
    def foo():
        """
        Help for group.
        """
        pass
    
    @foo.command()
    def command():
        """
        Help for command. This sentence shouldn't be included in the short help.
        """
        pass
    
    @foo.command(short_help="This won't be used by rich-click")
    def command2():
        """
        This should be overwritten by the explicitly passed short-help.
        """
        pass
    

    Output of foo --help using click:

    image

    And using rich-click:

    image

    Thanks again for making rich-click!

    missing click functionality high priority 
    opened by aazuspan 6
  • Feat #89 isolation and extensibility design

    Feat #89 isolation and extensibility design

    This is a large PR, and for that I apologize. I'm happy to make changes and provide additional explanation based on feedback.

    The main focus of this PR is to add support for isolating Rich Click's formatting and help configuration. The design supports isolation of these components by:

    1. Extending Click's HelpFormatter class
    2. Creating a HelpConfiguration class that doubles the current module-level settings
    3. Adding a decorator that allows the HelpConfiguration to be passed into Click via the supported context_settings argument provided by the Command and Group classes.

    Since this package does have an established user base I attempted to maintain the module-level settings behavior to prevent any breaking changes. I also added some tests to help verify the test suite using pytest and pytest-cov for test coverage. The tests are the bulk of this change as I used a snapshot-based approach to capture the input and output of the examples, and then validate their compatibility between module-level and context-level configuration.

    I got it a bit carried away and added a few other nuggets since they seemed closely related.

    1. The Rich Console object can also be configured per command and is distinct from the Console instance used internally by the formatter. The RichHelpFormatter creates a console based on the RichHelpConfiguration as the tight coupling between the Formatter and Click's internals make it difficult to allow the Console to be configured externally (i.e. one example is that Click expects help formatting to be buffered).
    2. RichContext class was created to allow creation of the custom formatter.
    3. The Rich Command, Group, and Context now expose the Console and RichHelpConfiguration properties. I thought this might make sense, but happy to remove if it might cause problems elsewhere.
    4. Added contributor vscode settings
    opened by BrutalSimplicity 5
  • click.ClickException should output to stderr

    click.ClickException should output to stderr

    rich_click override's click's default (and correct) behavior of writing exceptions (e.g., raise click.ClickException('There's a problem!')) to stderr. This has implications for CI/CD, for example, where a rich_click application may raise an exception but because it's being output to stdout, the task still passes.

    opened by mjkanji 4
  • Make `rich-click` extensible and isolate configuration state

    Make `rich-click` extensible and isolate configuration state

    Right now all of the functions in the rich_click module are difficult to override and extend behavior unless you extend one of the RichCommand or RichGroup classes. And even then, you can't really get access the the internals since the formatter is not being used and the results of rich_format_help are not returned to the caller.

    It would be nice if the Rich Console and rich_click configuration state could be configured/extended through class inheritance.

    This leads to two implementation changes.

    • One, move this behavior into a class with the configuration state encapsulated in the class.
    • Two, create extensible methods that allow one to change the Console configuration and/or results of certain formatting functions.

    For the first item, I think it might be possible to provide a class implementation of the formatter that could contain the state, and then expose a new method on the Context object that would allow you to configure the formatter before making the call to rich_format_help. For the most part, the module state is not a big problem since help generation is fired only once before application termination. However, one issue I've found is that letting the configuration sit in module state makes testing help messages difficult, since state changes leak across tests. I think it's also generally good practice to isolate state, and will make this library more reusable across the Click ecosystem.

    I think the changes for one would solve most of the issues with two. If you implement the formatter interface, others could hook into that functionality, and it could be configured along with whatever method or attribute you expose on the Context.

    opened by BrutalSimplicity 3
  • Rich Click breaks contract of Click's `format_help` and its callers

    Rich Click breaks contract of Click's `format_help` and its callers

    In Click, get_help calls the format_help method with a formatter that is expected to hold a buffer of the text that should be returned from the method as a string. Since rich_click does not write the terminal output to the buffer, but directly to the console, it breaks callers of get_help that expect to receive the console output.

    def get_help(self, ctx: Context) -> str:
        """Formats the help into a string and returns it.
    
        Calls :meth:`format_help` internally.
        """
        formatter = ctx.make_formatter()
        self.format_help(ctx, formatter)
        return formatter.getvalue().rstrip("\n")
    

    This may not be a problem for rich_click to solve, as I'm not sure the formatter interface would support all of the capabilities of Rich. But, it would be great if the API of Click could be maintained.

    Is this a problem that can be fixed by the following:

    1. Pass a string buffer to Rich Console that writes help output.
    2. Create a stub formatter implementing the getvalue method that returns the string buffer, or, override the get_help method to call format_help without the formatter and return the string buffer directly from Rich.

    Rich Reference:

    • https://rich.readthedocs.io/en/stable/console.html#capturing-output
    missing click functionality 
    opened by BrutalSimplicity 0
  • Provide help message when --help is used in a cli with required arguments

    Provide help message when --help is used in a cli with required arguments

    When building a cli with a required argument, when the command is specified without the required argument, rich-click prints the error as expected. But there is an exception to this, which is when the user tries to run the command with --help.

    In this case, the user is aware that an argument is required, but wants to get the full help, but because the required argument is not passed, the required argument error shows instead of the help message.

    I submit that using --help is a valid case where the required argument error should not override the following behaviour, which is the printing of the help string.

    To be fair, the same issue occurs in click as well, but there is a workaround for that in click which is to override the UsageError show method as shown in the SO link: https://stackoverflow.com/questions/39596070/python-click-custom-error-message

    How do I do something similar with rich-click?

    new feature 
    opened by girivs82 2
Releases(v1.6.0)
  • v1.6.0(Dec 5, 2022)

  • v1.5.2(Aug 1, 2022)

    ⚠️ Important notice! ⚠️

    As of Typer v0.6.0, Typer now supports rich help text natively. Support for Typer in rich-click is now depreciated and will be removed in a future release.

    What's changed

    • Pin Typer version to <0.6 when installing with pip install rich-click[typer]
    • Improve support for arguments [#82]
      • Fixes error with Typer arguments [#59]
      • Adds new style option STYLE_ARGUMENT
    • Don't show env vars if None [#84]
    • Specify __all__ for type checkers [#83]

    New Contributors

    • @ajparsons made their first contribution in https://github.com/ewels/rich-click/pull/83
    • @AlirezaTheH made their first contribution in https://github.com/ewels/rich-click/pull/82

    Full Changelog: https://github.com/ewels/rich-click/compare/v1.5.1...v1.5.2

    Source code(tar.gz)
    Source code(zip)
  • v1.5.1(Jun 22, 2022)

    • 🧹 Updated pip release build CI #78
    • 🐛 Added missed occurence of return values when standalone_mode set #79

    New Contributors

    • @zmoon made their first contribution in https://github.com/ewels/rich-click/pull/78

    Full Changelog: https://github.com/ewels/rich-click/compare/v1.5...v1.5.1

    Source code(tar.gz)
    Source code(zip)
  • v1.5(Jun 21, 2022)

    • ✨ Add new FORCE_TERMINAL config flag to force colours even when help output is piped. Can also be enabled by setting environment variables GITHUB_ACTIONS, FORCE_COLOR or PY_COLORS
    • ✨ Add new OPTION_ENVVAR_FIRST config flag to print environment variables before option help texts instead of after (nice for alignment if all options have an env var).
    • 🧹 Refactor config flag MAX_WIDTH to set the console width and not individual panels. Can now also be set with environment variable TERMINAL_WIDTH
    • :bug: Fix package syntax in setup.py for py.typed #75
    • :bug: Fix printing of return values when standalone_mode set #76

    New Contributors

    • @Stealthii made their first contribution in https://github.com/ewels/rich-click/pull/75
    • @mcflugen made their first contribution in https://github.com/ewels/rich-click/pull/76

    Full Changelog: https://github.com/ewels/rich-click/compare/v1.4...v1.5

    Source code(tar.gz)
    Source code(zip)
  • v1.4(May 17, 2022)

    Another bugfix release where I ended up adding in some more new features. You can now have quite a bit more control over how help texts are styled for options and commands - globally and even at specific group level.

    This is particularly useful for those of you with long help texts, as it's now possible to break those up visually with more spacing and custom colours / borders:

    styled output tables

    What's changed

    • ✨ Added support for styling the tables that options and commands are displayed in [#69]
    • 🐛 Fixed AttributeError from envvar code in some Typer usage [#70]

    Full Changelog: https://github.com/ewels/rich-click/compare/v1.3.2...v1.4

    Source code(tar.gz)
    Source code(zip)
  • v1.3.2(May 16, 2022)

    Missed one instance of inspect.cleandoc in the last patch release, this release hopefully covers all the places it's needed (thanks @apcamargo!)

    I felt bad doing a release which basically only included 18 characters of new code, so I also snuck in support for showing envvar (click + typer) in help texts:

    image

    What's changed

    • 🐛 Fix missed indentation issue in subcommand help text with inspect.cleandoc [#67]
    • ✨ Add support for showing Click / Typer envvar environment variables [#36]

    Full Changelog: https://github.com/ewels/rich-click/compare/v1.3.1...v1.3.2

    Source code(tar.gz)
    Source code(zip)
  • v1.3.1(May 14, 2022)

    This release is mostly minor bugfixes, many of which are to keep up with changes in the upstream Click codebase.

    Many thanks to everyone who has reported problems and contributed pull requests! 👏🏻

    Changes

    • Bumped minimum version of rich from 10 to 10.7.0 (when Group was introduced)
    • Refactored CLI's patching functionality to support from rich_click.cli import patch [#53]
    • Make _make_rich_rext remove text indentations using inspect.cleandoc [#55]
    • Import rich_click into main namespace for Pylance [#64]
    • Add support of new click hidden command parameter [#62]
    • Don't show Typer positional arguments unless SHOW_ARGUMENTS is specified [#59]
    • Fix \f escape marker for new versions of Click, including in markdown [#60]

    New Contributors

    • @apcamargo made their first contribution in https://github.com/ewels/rich-click/pull/56
    • @lgprobert made their first contribution in https://github.com/ewels/rich-click/pull/62
    • @kianmeng made their first contribution in https://github.com/ewels/rich-click/pull/65
    • @wfondrie made their first contribution in https://github.com/ewels/rich-click/pull/66

    Full Changelog: https://github.com/ewels/rich-click/compare/v1.3.0...v1.3.1

    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Mar 28, 2022)

    ✨ New features

    This release contains two main chunks of work:

    • Initial support for @tiangolo's Typer, added by @browniebroke [#26]
    • A fairly major overhaul of the code to introduce typing and additional code linting (pre-commit with iSort, mypy, Flake8), by @Jorricks [#37, #39, #40]

    ✍🏻 Output changes:

    • Change metavar overflow to fold, so that large numbers of choices flow onto new lines instead of being truncated with an ellipsis [#33]
    • Make metavar separators dim ([],<>) (customise with STYLE_METAVAR_SEPARATOR)
    • Parse emoji shortcodes :partying_face: [#51]

    🐛 Bug fixes:

    • Fixed bug where --no-myflag wasn't showing in the help [#45]

    👨🏻‍💻 Code changes:

    • Distribution now available via MacPorts [#42]
    • Pushed minimum version of Python up to 3.7, in line with Click v8.1
    • Mark PEP 561 Compatibility [#41]
    • Monkey-patch RichCommand and RichGroup in CLI code for better rich-click compatability with more tools [#43]

    Full Changelog: https://github.com/ewels/rich-click/compare/v1.2.1...v1.3.0

    Source code(tar.gz)
    Source code(zip)
  • v1.2.1(Mar 2, 2022)

    • Support the command short_help argument [#28]
    • Added USE_CLICK_SHORT_HELP global to enable default click shortening of help messages [#28]
    • Avoid AttributeError exceptions when using custom exception classes based on click that don't have ctx [#27]
    • Fix bug in inverted secondary options [#31]
    • Refactor printing options to handle arbitrary numbers of flags [#32]

    Full Changelog: https://github.com/ewels/rich-click/compare/v1.2.0...v1.2.1

    Source code(tar.gz)
    Source code(zip)
  • v1.2.0(Feb 28, 2022)

    • New CLI functionality to richifiy via prefix any other tool using click, by @pawamoy [#13]
      $ rich-click awesometool --help
      
      Usage: awesometool [OPTIONS]
      ..more richified output below..
      
    • Distribution now available via conda-forge

    Full Changelog: https://github.com/ewels/rich-click/compare/v1.1.1...v1.2.0

    Source code(tar.gz)
    Source code(zip)
  • v1.1.1(Feb 28, 2022)

  • v1.1.0(Feb 28, 2022)

    • Require at least click v7.0 (released 2018) #16
    • Require at least rich v10 (released March 2021) #16
    • Handle missing click.types._NumberRangeBase in click 7x #16
    • Fix compatibility issue for rich 10.6 (group vs render_group import) #16
    • Added support for HEADER_TEXT and FOOTER_TEXT to go before and after help output
    • Catch Abort exceptions from cmd+c and print nicely using ABORTED_TEXT
    • Unwrap single newlines in option and group-command help texts #23
    • Add click \b escape marker functionality into help text rendering #24
    • Fix syntax in example in README file by @fridex #15

    Full Changelog: https://github.com/ewels/rich-click/compare/v1.0.0...v1.1.0

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Feb 18, 2022)

    Major version bump as this release has a new usage method, which no longer requires monkey patching. Many thanks to @willmcgugan for the idea and @grst for discussion and help.

    • ⚠️ Major change: New usage, so that we can avoid having to do monkey patching #10.
      • Now use with import rich_click as click
    • Add ability to create groups of options with separate panels
    • Show positional arguments in their own panel by default
    • Add config GROUP_ARGUMENTS_OPTIONS option to group with options
    • Improve handing of metavars, give option to show appended instead of in column
    • Add COLOR_SYSTEM option to add ability to disable colours
    • Add options to customise error message help texts
    • Add support for printing errors nicely
    • A lot of additional testing and tweaking
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Feb 13, 2022)

    • Add ability to create groups of commands with separate panels
    • Add support for rich console markup or Markdown in help texts
    • Set default for MAX_WIDTH to None instead of 100
    • Switch boolean option SKIP_ARGUMENTS to SHOW_ARGUMENTS
    • Improve regular expression for flags like -bg
    • Use click's string for default value, instead of the value directly
    • Show some previously missed metavar types (eg. choice and range options)
    • Stripped required-asterisk column from options table if none are required
    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Feb 10, 2022)

    • Made most styling decisions configurable
    • Added support for more click parameters
      • Showing default values, showing if required, showing if deprecated, epilog
      • Option now hidden if set in click
    Source code(tar.gz)
    Source code(zip)
  • v0.1.2(Feb 10, 2022)

  • v0.1.1(Feb 10, 2022)

    There's probably a reason why you shouldn't throw together a new package and publish it on PyPI at midnight, just before bed, when you're sleep deprived with small children.

    This release fixes a bug in the setup.cfg that broke the installation.

    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(Feb 9, 2022)

    Initial development version of rich-click, mostly as a proof of concept.

    Supports basic generic functionality for printing help from click commands and groups.

    Code was initially written by @willmcgugan for rich-cli and then further developed by @ewels.

    Source code(tar.gz)
    Source code(zip)
Owner
Phil Ewels
Lead for bioinformatics dev for the @NationalGenomicsInfrastructure, part of @SciLifeLab in Stockholm. Author of @MultiQC and co-creator of @nf-core.
Phil Ewels
Rich is a Python library for rich text and beautiful formatting in the terminal.

The Rich API makes it easy to add color and style to terminal output. Rich can also render pretty tables, progress bars, markdown, syntax highlighted source code, tracebacks, and more — out of the box.

Will McGugan 41.4k Jan 3, 2023
Write Django management command using the click CLI library

Django Click Project information: Automated code metrics: django-click is a library to easily write Django management commands using the click command

Jonathan Stoppani 215 Dec 19, 2022
frogtrade9000 - a command-line Rich client for the freqtrade REST API

frogtrade9000 - a command-line Rich client for the freqtrade REST API I found FreqUI too cumbersome and slow on my Raspberry Pi 400 when running multi

Robert Davey 79 Dec 2, 2022
Output Analyzer for you terminal commands

Output analyzer (OZER) You can specify a few words inside config.yaml file and specify the color you want to be used. installing: Install command usin

Ehsan Shirzadi 1 Oct 21, 2021
Python Processing Tool for Vasp Ipnut/Output

PivotPy A Python Processing Tool for Vasp Input/Output. A CLI is available in Powershell, see Vasp2Visual. <style>a{text-decoration: none !important;c

Abdul Saboor 5 Aug 16, 2022
Runs a command in P4wnP1 and displays the output on OLED screen (SH1106)

p4wnp1-oled-terminal Runs a command in P4wnP1 and displays the output on OLED screen (SH1106) Works on Raspberry Pi Zero 2 W Tested successfully on RP

PawnSolo 1 Dec 14, 2021
Ipylivebash - Run shell script in Jupyter with live output

ipylivebash ipylivebash is a library to run shell script in Jupyter with live ou

Ben Lau 6 Aug 27, 2022
Tablicate - Python library for easy table creation and output to terminal

Tablicate Tablicate - Python library for easy table creation and output to terminal Features Column-wise justification alignment (left, right, center)

null 3 Dec 14, 2022
Command line parser for common log format (Nginx default).

Command line parser for common log format (Nginx default).

Lucian Marin 138 Dec 19, 2022
A Python module and command line utility for working with web archive data using the WACZ format specification

py-wacz The py-wacz repository contains a Python module and command line utility for working with web archive data using the WACZ format specification

Webrecorder 14 Oct 24, 2022
Spotify Offline is a command line tool that allows one to download Spotify playlists in MP3 format.

Spotify Offline v0.0.2 listen to your favorite spotify songs, offline Overview Spotify Offline (spotifyoffline) is a command line tool that allows one

Aarush Gupta 1 Nov 28, 2021
A Python module and command-line utility for converting .ANS format ANSI art to HTML

ansipants A Python module and command-line utility for converting .ANS format ANSI art to HTML. Installation pip install ansipants Command-line usage

null 4 Oct 16, 2022
Management commands to help backup and restore your project database and media files

Django Database Backup This Django application provides management commands to help backup and restore your project database and media files with vari

null 687 Jan 4, 2023
The project help you to quickly build layouts in terminal,cross-platform

The project help you to quickly build layouts in terminal,cross-platform

gojuukaze 133 Nov 30, 2022
pyGinit is a command line tools that help you to initialize your current project a local git repo and remote repo

pyGinit pyGinit is a command line tools that help you to initialize your current project a local git repo and remote repo Requirements Requirements be

AlphaBeta 15 Feb 26, 2022
Collection of useful command line utilities and snippets to help you organise your workspace and improve workflow.

Collection of useful command line utilities and snippets to help you organise your workspace and improve workflow.

Dominik Tarnowski 3 Dec 26, 2021
This is a CLI program which can help you generate your own QR Code.

Python-QR-code-generator This is a CLI program which can help you generate your own QR Code. Single.py This will allow you only to input a single mess

null 1 Dec 24, 2021