Cleo allows you to create beautiful and testable command-line interfaces.

Related tags

python cli
Overview

Cleo

Cleo Build status

Create beautiful and testable command-line interfaces.

Cleo is mostly a higher level wrapper for CliKit, so a lot of the components and utilities comes from it. Refer to its documentation for more information.

Resources

Usage

To make a command that greets you from the command line, create greet_command.py and add the following to it:

from cleo import Command


class GreetCommand(Command):
    """
    Greets someone

    greet
        {name? : Who do you want to greet?}
        {--y|yell : If set, the task will yell in uppercase letters}
    """

    def handle(self):
        name = self.argument('name')

        if name:
            text = 'Hello {}'.format(name)
        else:
            text = 'Hello'

        if self.option('yell'):
            text = text.upper()

        self.line(text)

You also need to create the file to run at the command line which creates an Application and adds commands to it:

#!/usr/bin/env python

from greet_command import GreetCommand
from cleo import Application

application = Application()
application.add(GreetCommand())

if __name__ == '__main__':
    application.run()

Test the new command by running the following

$ python application.py greet John

This will print the following to the command line:

Hello John

You can also use the --yell option to make everything uppercase:

$ python application.py greet John --yell

This prints:

HELLO JOHN

As you may have already seen, Cleo uses the command docstring to determine the command definition. The docstring must be in the following form :

"""
Command description

Command signature
"""

The signature being in the following form:

"""
command:name {argument : Argument description} {--option : Option description}
"""

The signature can span multiple lines.

"""
command:name
    {argument : Argument description}
    {--option : Option description}
"""

Coloring the Output

Whenever you output text, you can surround the text with tags to color its output. For example:

# green text
self.line('<info>foo</info>')

# yellow text
self.line('<comment>foo</comment>')

# black text on a cyan background
self.line('<question>foo</question>')

# white text on a red background
self.line('<error>foo</error>')

The closing tag can be replaced by </>, which revokes all formatting options established by the last opened tag.

It is possible to define your own styles using the add_style() method:

self.add_style('fire', fg='red', bg='yellow', options=['bold', 'blink'])
self.line('<fire>foo</fire>')

Available foreground and background colors are: black, red, green, yellow, blue, magenta, cyan and white.

And available options are: bold, underscore, blink, reverse and conceal.

You can also set these colors and options inside the tag name:

# green text
self.line('<fg=green>foo</>')

# black text on a cyan background
self.line('<fg=black;bg=cyan>foo</>')

# bold text on a yellow background
self.line('<bg=yellow;options=bold>foo</>')

Verbosity Levels

Cleo has four verbosity levels. These are defined in the Output class:

Mode Meaning Console option
NA Do not output any messages -q or --quiet
clikit.VERBOSITY_NORMAL The default verbosity level (none)
clikit.VERBOSITY_VERBOSE Increased verbosity of messages -v
clikit.VERBOSITY_VERY_VERBOSE Informative non essential messages -vv
clikit.VERBOSITY_DEBUG Debug messages -vvv

It is possible to print a message in a command for only a specific verbosity level. For example:

if clikit.VERBOSITY_VERBOSE <= self.io.verbosity:
    self.line(...)

There are also more semantic methods you can use to test for each of the verbosity levels:

if self.output.is_quiet():
    # ...

if self.output.is_verbose():
    # ...

You can also pass the verbosity flag directly to line().

self.line("", verbosity=clikit.VERBOSITY_VERBOSE)

When the quiet level is used, all output is suppressed.

Using Arguments

The most interesting part of the commands are the arguments and options that you can make available. Arguments are the strings - separated by spaces - that come after the command name itself. They are ordered, and can be optional or required. For example, add an optional last_name argument to the command and make the name argument required:

class GreetCommand(Command):
    """
    Greets someone

    greet
        {name : Who do you want to greet?}
        {last_name? : Your last name?}
        {--y|yell : If set, the task will yell in uppercase letters}
    """

You now have access to a last_name argument in your command:

last_name = self.argument('last_name')
if last_name:
    text += ' {}'.format(last_name)

The command can now be used in either of the following ways:

$ python application.py greet John
$ python application.py greet John Doe

It is also possible to let an argument take a list of values (imagine you want to greet all your friends). For this it must be specified at the end of the argument list:

class GreetCommand(Command):
    """
    Greets someone

    greet
        {names* : Who do you want to greet?}
        {--y|yell : If set, the task will yell in uppercase letters}
    """

To use this, just specify as many names as you want:

$ python application.py demo:greet John Jane

You can access the names argument as a list:

names = self.argument('names')
if names:
    text += ' {}'.format(', '.join(names))

There are 3 argument variants you can use:

Mode Notation Value
clikit.ARGUMENT_REQUIRED none (just write the argument name) The argument is required
clikit.ARGUMENT_OPTIONAL argument? The argument is optional and therefore can be omitted
clikit.ARGUMENT_MULTI_VALUED argument* The argument can contain an indefinite number of arguments and must be used at the end of the argument list

You can combine them like this:

class GreetCommand(Command):
    """
    Greets someone

    greet
        {names?* : Who do you want to greet?}
        {--y|yell : If set, the task will yell in uppercase letters}
    """

If you want to set a default value, you can it like so:

argument=default

The argument will then be considered optional.

Using Options

Unlike arguments, options are not ordered (meaning you can specify them in any order) and are specified with two dashes (e.g. --yell - you can also declare a one-letter shortcut that you can call with a single dash like -y). Options are always optional, and can be setup to accept a value (e.g. --dir=src) or simply as a boolean flag without a value (e.g. --yell).

Tip

It is also possible to make an option optionally accept a value (so that --yell or --yell=loud work). Options can also be configured to accept a list of values.

For example, add a new option to the command that can be used to specify how many times in a row the message should be printed:

class GreetCommand(Command):
    """
    Greets someone

    greet
        {name? : Who do you want to greet?}
        {--y|yell : If set, the task will yell in uppercase letters}
        {--iterations=1 : How many times should the message be printed?}
    """

Next, use this in the command to print the message multiple times:

for _ in range(0, self.option('iterations')):
    self.line(text)

Now, when you run the task, you can optionally specify a --iterations flag:

$ python application.py demo:greet John
$ python application.py demo:greet John --iterations=5

The first example will only print once, since iterations is empty and defaults to 1. The second example will print five times.

Recall that options don't care about their order. So, either of the following will work:

$ python application.py demo:greet John --iterations=5 --yell
$ python application.py demo:greet John --yell --iterations=5

There are 4 option variants you can use:

Option Notation Value
clikit.OPTION_MULTI_VALUED --option=* This option accepts multiple values (e.g. --dir=/foo --dir=/bar)
clikit.OPTION_NO_VALUE --option Do not accept input for this option (e.g. --yell)
clikit.OPTION_REQUIRED_VALUE --option= This value is required (e.g. --iterations=5), the option itself is still optional
clikit.OPTION_OPTIONAL_VALUE --option=? This option may or may not have a value (e.g. --yell or --yell=loud)

You can combine them like this:

class GreetCommand(Command):
    """
    Greets someone

    greet
        {name? : Who do you want to greet?}
        {--y|yell : If set, the task will yell in uppercase letters}
        {--iterations=?*1 : How many times should the message be printed?}
    """

Testing Commands

Cleo provides several tools to help you test your commands. The most useful one is the CommandTester class. It uses a special IO class to ease testing without a real console:

import pytest

from cleo import Application
from cleo import CommandTester

def test_execute(self):
    application = Application()
    application.add(GreetCommand())

    command = application.find('demo:greet')
    command_tester = CommandTester(command)
    command_tester.execute()

    assert "..." == tester.io.fetch_output()

The CommandTester.io.fetch_output() method returns what would have been displayed during a normal call from the console. CommandTester.io.fetch_error() is also available to get what you have been written to the stderr.

You can test sending arguments and options to the command by passing them as a string to the CommandTester.execute() method:

import pytest

from cleo import Application
from cleo import CommandTester

def test_execute(self):
    application = Application()
    application.add(GreetCommand())

    command = application.find('demo:greet')
    command_tester = CommandTester(command)
    command_tester.execute("John")

    assert "John" in tester.io.fetch_output()

You can also test a whole console application by using the ApplicationTester class.

Calling an existing Command

If a command depends on another one being run before it, instead of asking the user to remember the order of execution, you can call it directly yourself. This is also useful if you want to create a "meta" command that just runs a bunch of other commands.

Calling a command from another one is straightforward:

def handle(self):
    return_code = self.call('demo:greet', "John --yell")

    # ...

If you want to suppress the output of the executed command, you can use the call_silent() method instead.

Autocompletion

Cleo supports automatic (tab) completion in bash, zsh and fish.

To activate support for autocompletion, pass a complete keyword when initializing your application:

application = Application('My Application', '0.1', complete=True)

Now, register completion for your application by running one of the following in a terminal, replacing [program] with the command you use to run your application:

# BASH - Ubuntu / Debian
[program] completions bash | sudo tee /etc/bash_completion.d/[program].bash-completion

# BASH - Mac OSX (with Homebrew "bash-completion")
[program] completions bash > $(brew --prefix)/etc/bash_completion.d/[program].bash-completion

# ZSH - Config file
mkdir ~/.zfunc
echo "fpath+=~/.zfunc" >> ~/.zshrc
[program] completions zsh > ~/.zfunc/_test

# FISH
[program] completions fish > ~/.config/fish/completions/[program].fish
Issues
  • Hint at expected/default input for `confirm` command

    Hint at expected/default input for `confirm` command

    I just spent an embarrassing amount of time absent-mindedly hitting the return key to agree to running my orator migrations and wondering why they wouldn't have any effect.

    Maybe hinting at what kind of input is expected would be helpful?

    cleo image

    laravel artisan image

    opened by tsterker 6
  • GreetCommand demo as object

    GreetCommand demo as object

    Hello,

    I just try the demo GreetCommand from your doc. The first one work but not the object version.

    When I execute it I have the following:

    [email protected]:~/workspace/commander$ ./console
    Traceback (most recent call last):
      File "./console", line 8, in <module>
        application.add(GreetCommand())
      File "/usr/local/lib/python2.7/dist-packages/cleo/commands/command.py", line 36, in __init__
        self.configure()
    TypeError: configure() takes no arguments (1 given)
    

    But I don't understand wich argument must be gived.

    doc 
    opened by movrack 5
  • Cleo 0.4 with fish/zsh : Unable to hide secret

    Cleo 0.4 with fish/zsh : Unable to hide secret

    I was just trying the library and just for test I added a secret prompt. But every time when I run the application I get the exception "Unable to hide secret". At first I thought that it is because of fish shell, but switching to zsh but the exception still comes.

    The code in the handle function:

            if name:
                text = '<info>Hello %s</info>' % name
            else:
                password = self.secret("Please enter a secret")
                text = '<info>Hello %s</info>' % password
    
    bug 
    opened by vkolev 4
  • #37: Fills progress bar on finish

    #37: Fills progress bar on finish

    Fixes #37 This attempts to fill the progress bar after the finish() method is called for the progress bar.

    opened by onema 2
  • Binary dependecy ``hiddeninput.exe`` is really needed?

    Binary dependecy ``hiddeninput.exe`` is really needed?

    Hello,

    I am concerned about why is there a binary executable bundled in the package (I am referring to cleo/resources/bin/hiddeninput.exe). This executable provides no information about its origin, has no digital signature and I don't believe it is the best practice to distribute it with the package. In addition, I see it is compiled using the Visual C 2010 runtime, which might not be satisfied on all Windows computers running Python (from Python 3.5, the interpreter only requires the Visual C 2015 runtime).

    Some alternatives that I suggest are:

    • using the getpass builtin module (https://docs.python.org/3/library/getpass.html ) which is cross-platform.
    • distribute it as a binary extension (publishing its code in the package and require it to be built when installing the package). This method can raise the popular error error: Unable to find vcvarsall.bat as most Windows distributions come without a C/C++ compiler, error which is hard to work around (requires installation of extra packages from Microsoft).

    Let me know what you think, Have a nice day!

    opened by vladcalin 2
  • Problem with UTF-8 chars

    Problem with UTF-8 chars

    The width of a column with UTF-8 chars is broken.

    +--------------------------------------+---------------------------------------+
    | Name                                 | Company                               |
    +--------------------------------------+---------------------------------------+
    | Šikland.cz                          | WESTERN Šiklův mlýn, s.r.o.        |
    | U Spiritky                           | Mgr. Josef Sluka                      |
    | Hero                                 | Cognito.cz, s.r.o.                    |
    | Dobré účetnictví                 | APOGEO, s.r.o.                        |
    | Ústnípéče.cz                     | Apollonia Dental s.r.o.               |
    
    bug 
    opened by hason 1
  • Option shortcut only work with single characters

    Option shortcut only work with single characters

    If I set up an option with a shortcut like s3, or vv, or vvv it doesn't work.

    opened by onema 1
  • Change argument mode, when an option was supplied

    Change argument mode, when an option was supplied

    Hi! Is there a way to change argument mode, when an option was supplied? It would be really nice, if I can implement it using validators.

    I got it, but I'm not sure that the validators order will not change in the future.

    from cleo import Command, InputArgument, InputOption
    from cleo.validators import Validator
    
    
    class RunCommand(Command):
        def configure(self):
            self.set_name('run')
            self.set_description('Run')
            self.set_help('Run')
    
            chain = Chain()
            self.add_argument(
                name='package',
                description='Package to run',
                default=None,
                mode=InputArgument.OPTIONAL,
                validator=PackageValidator(chain)
            )
            self.add_option(
                name='path',
                shortcut='p',
                description='Path to module',
                default=None,
                mode=InputOption.VALUE_REQUIRED,
                validator=PathValidator(chain)
            )
    
        def execute(self, input_, ouput_):
            pass
    
    
    class Chain(object):
        def __init__(self):
            self._package = None
            self._path = None
    
        def set_package(self, package):
            self._package = package
    
        def set_path(self, path):
            self._path = path
    
        def validate(self):
            if self._path and not self._package:
                raise ValueError('Cannot supply [-p|--path] without [package].')
    
    
    class PackageValidator(Validator):
        def __init__(self, chain):
            self.chain = chain
    
        def validate(self, value):
            self.chain.set_package(value)
            # Validate package...
    
    
    class PathValidator(Validator):
        def __init__(self, chain):
            self.chain = chain
    
        def validate(self, value):
            self.chain.set_path(value)
            self.chain.validate()
            # Validate path...
    
    opened by ghost 1
  • [Feature Request] Convert arguments and options using validators

    [Feature Request] Convert arguments and options using validators

    For example, I have the following validator:

    class Integer(Validator):
        def validate(self, value):
            try:
                return int(value)
            except ValueError:
                self.error(value)
    
    

    And when I've called input_.get_argument('intarg'), it should return an integer instead of string.

    bug 
    opened by ghost 1
  • Corrected typo in changelog

    Corrected typo in changelog

    opened by SohierDane 1
  • Allow for empty answer in ChoiceQuestion

    Allow for empty answer in ChoiceQuestion

    Otherwise, an AttributeError is raised.

    Related downstream ticket https://github.com/python-poetry/poetry/issues/2355.

    opened by jacobperron 0
  • Why progress-indicator defaults the output to standard error instead of standard output?

    Why progress-indicator defaults the output to standard error instead of standard output?

    https://github.com/sdispater/clikit/blob/master/src/clikit/ui/components/progress_indicator.py#L31 https://github.com/sdispater/cleo/blob/master/cleo/ui/progress_indicator.py#L35

    class ProgressIndicator(object):
    
        def __init__(self, ...):
            if isinstance(io, IO):
                io = io.error_output
    

    I could not infer the reasoning behind this. I would think stderr should be empty if there is no error.

    opened by gmichaeljaison 0
  • Use add_css_file instead of add_stylesheet

    Use add_css_file instead of add_stylesheet

    See

    https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_css_file

    https://github.com/sphinx-doc/sphinx/issues/7747

    Should fix #105

    opened by Ivoz 1
  • 0.8.1: not ready for sphinx 4.1.x

    0.8.1: not ready for sphinx 4.1.x

    I'm trying to package your module as an rpm package. Obn building documentation looks like sphinx 4.1.2 is failing with:

    + sphinx-build -b man -d cleo docs .
    Running Sphinx v4.1.2
    
    Exception occurred:
      File "/home/tkloczko/rpmbuild/BUILD/cleo-0.8.1/docs/conf.py", line 268, in setup
        app.add_stylesheet("theme_overrides.css")
    AttributeError: 'Sphinx' object has no attribute 'add_stylesheet'
    The full traceback has been saved in /tmp/sphinx-err-zcs3lqm_.log, if you want to report the issue to the developers.
    Please also report this if it was a user error, so that a better error message can be provided next time.
    A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
    

    Looks like a lot of other modules had the same issues on mogration to sphinx 4 https://github.com/sphinx-doc/sphinx/issues/7747

    opened by kloczek 0
  • cleo fails to detect ANSI support in Windows when run under a VT-native environment

    cleo fails to detect ANSI support in Windows when run under a VT-native environment

    This is a replication of https://github.com/sdispater/clikit/issues/35, as the faulty code moved from clikit to cleo.

    The current final test of StreamOutput._has_color_support on Windows: https://github.com/sdispater/cleo/blob/7ebf50b4c85e0eca2d9f295588150527c95c84de/cleo/io/outputs/stream_output.py#L141-L147

    returns False if ENABLE_VIRTUAL_TERMINAL_PROCESSING is already enabled, as is the case for Windows Terminal.

    It should return True, since if ENABLE_VIRTUAL_TERMINAL_PROCESSING is already enabled, then we clearly have ANSI.

    I suggest flipping the logic to look like

     if (mode.value & ENABLE_VIRTUAL_TERMINAL_PROCESSING) != 0: 
         return True
    
     return kernel32.SetConsoleMode( 
          h, mode.value | ENABLE_VIRTUAL_TERMINAL_PROCESSING 
      ) != 0
    

    so that if ENABLE_VIRTUAL_TERMINAL_PROCESSING is already set, the output stream is seen as ANSI-enabled, and otherwise, only report ANSI-enabled if successfully able to change modes.

    This also fixes the issue that the return value of kernel32.SetConsoleMode is not being checked, although I'm not aware of a situation that would reject that particular call.

    The user-visible behaviour issue is https://github.com/python-poetry/poetry/issues/3354

    opened by TBBle 0
  • Documentation is down

    Documentation is down

    image

    opened by eamanu 0
  • Can't add an option with name `n`

    Can't add an option with name `n`

    I want to add an option with name n

    {--n|names=* : Some description}
    

    But I get this:

    Traceback (most recent call last):
      File "/Users/an/Desktop/vkquick/env/bin/vq", line 2, in <module>
        from vkquick.__main__ import app
      File "/Users/an/Desktop/vkquick/vkquick/__main__.py", line 23, in <module>
        app.add_commands(New(), DebugRun(), ReleaseRun(), Com())
      File "/Users/an/Desktop/vkquick/env/lib/python3.8/site-packages/cleo/application.py", line 36, in add_commands
        self.add(command)
      File "/Users/an/Desktop/vkquick/env/lib/python3.8/site-packages/cleo/application.py", line 42, in add
        self.add_command(command.config)
      File "/Users/an/Desktop/vkquick/env/lib/python3.8/site-packages/clikit/console_application.py", line 163, in add_command
        command = Command(config, self)
      File "/Users/an/Desktop/vkquick/env/lib/python3.8/site-packages/clikit/api/command/command.py", line 35, in __init__
        self._args_format = config.build_args_format(self.base_format)
      File "/Users/an/Desktop/vkquick/env/lib/python3.8/site-packages/clikit/api/config/command_config.py", line 159, in build_args_format
        builder.add_options(*self.options.values())
      File "/Users/an/Desktop/vkquick/env/lib/python3.8/site-packages/clikit/api/args/format/args_format_builder.py", line 292, in add_options
        self.add_option(option)
      File "/Users/an/Desktop/vkquick/env/lib/python3.8/site-packages/clikit/api/args/format/args_format_builder.py", line 302, in add_option
        raise CannotAddOptionException.already_exists(short_name)
    clikit.api.args.exceptions.CannotAddOptionException: An option named "-n" exists already.
    

    There aren't any options with name n so I think it is a "built-in". Can I override it?

    opened by deknowny 0
  • Add

    Add "choices" parameter to argument and option as in argparse

    Summary

    Add choices parameter to argument and option functions to accept list of allowed values for an argument or an option. Reject any values that do not match the provided list.

    Enhancement's value

    • This would allow developers to specify a limited set of choices and automatically validate the input against that list.
    • It will be rendered in the documentation generated via --help, help and, thus, automatically explain to user what values are accepted for this option/argument – huge help for users.

    Notes

    Maybe take the same approach that works in argparse?

    opened by vduseev 0
Releases(1.0.0a4)
  • 1.0.0a4(Jul 30, 2021)

  • 1.0.0a3(Feb 21, 2021)

  • 1.0.0a2(Feb 13, 2021)

  • 1.0.0a1(Jan 29, 2021)

  • 0.8.1(Apr 17, 2020)

  • 0.7.6(Oct 25, 2019)

  • 0.7.5(Jun 28, 2019)

  • 0.7.4(May 15, 2019)

  • 0.7.3(May 11, 2019)

    Added

    • Added the argument and option helpers.

    Fixed

    • Fixed the decorated option for the command tester.
    • Fixed tested applications being terminated after execution.
    Source code(tar.gz)
    Source code(zip)
  • 0.7.2(Dec 8, 2018)

  • 0.7.1(Dec 7, 2018)

  • 0.7.0(Dec 7, 2018)

    This version breaks backwards compatibility and caution is advised when updating.

    While the public API of the Command class is mostly the same, a lot of the internals has changed or has been removed.

    Cleo is now mostly a higher level wrapper for CliKit which is more flexible.

    Added

    • Added a sub command system via CliKit.
    • Added an event system via CliKit.

    Changed

    • All helper classes have been removed. If you use the Command methods this should not affect you.
    • The testers get_display() method has been removed. Use tester.io.fetch_output().
    • The testers execute() method no longer requires the command name and requires a string as arguments instead of a list.
    • The testers execute() method now accepts a inputs keyword argument to pass user inputs.
    • The call() method no longer requires the command name and requires a string as arguments instead of a list.
    • The tables now automatically wraps the cells based on the available width.
    • The table separators and table cells elements have been removed.
    • The look and feel of the help command has changed.
    • Namespace commands are no longer supported and will be treated as standard commands.
    • The list command has been removed and merged with help.
    Source code(tar.gz)
    Source code(zip)
  • 0.6.8(Jun 25, 2018)

    Changed

    • Testers (application and command) now automatically sets decorated to False.

    Fixed

    • Fixed numeric values appearing when getting terminal size on Windows.
    Source code(tar.gz)
    Source code(zip)
  • 0.6.7(Jun 25, 2018)

  • 0.6.6(May 21, 2018)

  • 0.6.4(Mar 15, 2018)

  • 0.6.2(Mar 15, 2018)

  • 0.6.1(Aug 7, 2017)

  • 0.6.0(Apr 21, 2017)

    Added

    • Added a new completions command to generate autocompletion scripts.
    • Added support for command signature inheritance.
    • Added a new spin() helper to display a spinner.

    Changed

    • Removed the _completion command.
    • Removes ability to choose when a command anme is ambiguous.
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Sep 21, 2016)

    This is major release with some API changes.

    Added

    • Commands definition can now be specified with the class docstring (support for string signature)
    • Two other levels of verbosity (-vv and -vvv) have been added
    • Commands description can now be output as json and markdown

    Changed

    • The Command class is now more high-level with a single handle() method to override and useful helper methods
    • The ProgressHelper has been removed and the ProgressBar class must be used
    • The TableHelper has largely been improved
    • DialogHelper has been replaced by a more robust QuestionHelper
    • Command.set_code() logic has changed to accept a Command instance to be able to use the new helper methods
    • Autocompletion has been improved

    Fixed

    • Values are now properly cast by validators
    • Fixing "flag" not being set properly
    • Progress bar now behaves properly (Fixes #37)
    • The -n|--no-interaction option behaves properly
    Source code(tar.gz)
    Source code(zip)
  • v0.4.1(Sep 21, 2016)

  • 0.5.0(Sep 21, 2016)

    Added

    • Improves terminal handling by adding the Terminal class.
    • Adds methods to write to stderr.
    • Adds write() and overwrite() method to commands.
    • Adds ability to regress progress bar.
    • Adds ability to choose when a command name is ambiguous.

    Changed

    • Removes support for decorators and dictionaries declarations.
    • Simplifies public API for creating arguments and options.
    • Improves string formatting.
    • Hides _completion command from list.
    • Improves aliases display.
    • Displays errors even in quiet mode
    • Changes console header format
    • Simplifies the way to create single command application.
    • Simplifies command testing with user inputs.
    Source code(tar.gz)
    Source code(zip)
Owner
Sébastien Eustace
Software engineer, proud pythonista, open source lover. Creator of the Poetry package manager and the datetime library Pendulum.
Sébastien Eustace
A drop-in replacement for argparse that allows options to also be set via config files and/or environment variables.

ConfigArgParse Overview Applications with more than a handful of user-settable options are best configured through a combination of command line args,

null 544 Oct 18, 2021
Rich is a Python library for rich text and beautiful formatting in the terminal.

Rich 中文 readme • lengua española readme • Läs på svenska Rich is a Python library for rich text and beautiful formatting in the terminal. The Rich API

Will McGugan 30.4k Oct 24, 2021
Cement is an advanced Application Framework for Python, with a primary focus on CLI

Cement Framework Cement is an advanced Application Framework for Python, with a primary focus on Command Line Interfaces (CLI). Its goal is to introdu

Data Folk Labs, LLC 1k Oct 25, 2021
Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object.

Python Fire Python Fire is a library for automatically generating command line interfaces (CLIs) from absolutely any Python object. Python Fire is a s

Google 20.3k Oct 24, 2021
Python composable command line interface toolkit

$ click_ Click is a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary. It's the "Comm

The Pallets Projects 11.5k Oct 24, 2021
Color text streams with a polished command line interface

colout(1) -- Color Up Arbitrary Command Output Synopsis colout [-h] [-r RESOURCE] colout [-g] [-c] [-l min,max] [-a] [-t] [-T DIR] [-P DIR] [-d COLORM

nojhan 1.1k Sep 28, 2021
A fast, stateless http slash commands framework for scale. Built by the Crunchy bot team.

Roid ?? A fast, stateless http slash commands framework for scale. Built by the Crunchy bot team. ?? Installation You can install roid in it's default

Harrison Burt 7 Oct 17, 2021
Python and tab completion, better together.

argcomplete - Bash tab completion for argparse Tab complete all the things! Argcomplete provides easy, extensible command line tab completion of argum

Andrey Kislyuk 991 Oct 22, 2021
A thin, practical wrapper around terminal capabilities in Python

Blessings Coding with Blessings looks like this... from blessings import Terminal t = Terminal() print(t.bold('Hi there!')) print(t.bold_red_on_brig

Erik Rose 1.3k Oct 19, 2021
sane is a command runner made simple.

sane is a command runner made simple.

Miguel M. 14 Jul 24, 2021
plotting in the terminal

bashplotlib plotting in the terminal what is it? bashplotlib is a python package and command line tool for making basic plots in the terminal. It's a

Greg Lamp 1.6k Oct 17, 2021
Typer, build great CLIs. Easy to code. Based on Python type hints.

Typer, build great CLIs. Easy to code. Based on Python type hints. Documentation: https://typer.tiangolo.com Source Code: https://github.com/tiangolo/

Sebastián Ramírez 6.5k Oct 22, 2021
Library for building powerful interactive command line applications in Python

Python Prompt Toolkit prompt_toolkit is a library for building powerful interactive command line applications in Python. Read the documentation on rea

prompt-toolkit 7.3k Oct 23, 2021
Python Command-line Application Tools

Clint: Python Command-line Interface Tools Clint is a module filled with a set of awesome tools for developing commandline applications. C ommand L in

Kenneth Reitz Archive 57 Oct 12, 2021
Simple cross-platform colored terminal text in Python

Colorama Makes ANSI escape character sequences (for producing colored terminal text and cursor positioning) work under MS Windows. PyPI for releases |

Jonathan Hartley 2.6k Oct 23, 2021
Command line animations based on the state of the system

shell-emotions Command line animations based on the state of the system for Linux or Windows 10 The ascii animations were created using a modified ver

Simon Malave 61 Oct 21, 2021
A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations

ASCIIMATICS Asciimatics is a package to help people create full-screen text UIs (from interactive forms to ASCII animations) on any platform. It is li

null 2.8k Oct 23, 2021
Python library that measures the width of unicode strings rendered to a terminal

Introduction This library is mainly for CLI programs that carefully produce output for Terminals, or make pretend to be an emulator. Problem Statement

Jeff Quast 250 Oct 15, 2021
CalcuPy 📚 Create console-based calculators in a few lines of code.

CalcuPy ?? Create console-based calculators in a few lines of code. ?? Installation pip install calcupy ?? Usage from calcupy import Calculator calc

Dylan Tintenfich 6 Sep 26, 2021