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

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
Comments
  • Decrease default errors verbosity

    Decrease default errors verbosity

    This shifts error verbosity to reduce terminal output pollution

    Replaces

    https://github.com/python-poetry/poetry/pull/2915 https://github.com/python-poetry/poetry/pull/5559

    Resolves:

    https://github.com/python-poetry/poetry/issues/2854 https://github.com/python-poetry/poetry/issues/3273 https://github.com/python-poetry/poetry/issues/4014 https://github.com/python-poetry/poetry/issues/5229

    Current behaviour

    • default: render error with source reference and solution if present
    • CleoSimpleException: render it with just a message, never display solution
    • io.is_verbose(): default + full stack trace

    New behaviour

    • default / CleoSimpleException: render error with just a message + solution if present
    • io.is_verbose(): render error with source reference + solution if present
    • io.is_very_verbose(): io.is_verbose() + full stack trace

    In other words

    • simple is enabled by default (whilst supporting solutions)
    • verbose is now previous default (compact source reference)
    • very_verbose is now previous verbose

    Showcase

    image
    opened by Bobronium 10
  • improve performance of find_similar_names

    improve performance of find_similar_names

    on most platforms this improves the performance by 30-40x by using a highly optimized C extension. On unsupported platforms falls back to a pure Python implementation, which still improves performance by 2x.

    I am not really familiar with poetry. I used:

    poetry add rapidfuzz
    poetry remove pylev
    

    However this removed files for a lot of dependencies, which seems wrong. What is the correct process to replace a dependency?

    opened by maxbachmann 8
  • 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
  • Cleo2.x break backward compatible with optional value

    Cleo2.x break backward compatible with optional value

    Before Cleo 1.0, there was a nice feature for an optional value to a option.

    It was implemented by clikit as below: clikit.OPTION_OPTIONAL_VALUE --option=? This option may or may not have a value (e.g. --yell or --yell=loud)

    However, from Cleo 1.0, optional value has been removed, which cause existing application hard to upgrade to the latest Cleo version.

    Is there any suggestion to this issue? Many thanks.

    opened by zlogz101 5
  • Default --no-interactive to on when CI=true

    Default --no-interactive to on when CI=true

    By setting --no-interactive to on when the environment variable CI is true, we can help avoid situations where a CI pipeline accidentally blocks waiting for user input when none will arrive. This will help prevent precious compute resources from being wasted.

    opened by djmattyg007 5
  • Fix zsh completion

    Fix zsh completion

    Before we were implicitly declaring the opts and coms arrays, which had the undesired effect of zsh parsing it as an associative array instead of a normal array.

    Now we explicitly declare the opts and coms arrays to be normal arrays.

    opened by ad-chaos 5
  • Document autocompletion for brew-installed Zsh

    Document autocompletion for brew-installed Zsh

    Worked for me. I learned about this from poetry's README: https://github.com/python-poetry/poetry#enable-tab-completion-for-bash-fish-or-zsh

    TODO: looks like https://github.com/sdispater/cleo/blob/master/docs/introduction.rst should be aligned with this

    opened by juhoautio 5
  • 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:

    manu@Uvito:~/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
  • fix incompatible zsh syntax used in bash

    fix incompatible zsh syntax used in bash

    bash can't use

    case EXPRESSION in (case) COMMAND-LIST;; ... esac
                       ^
                        '- invalid syntax
    

    bash case grammar:

    case EXPRESSION in CASE1) COMMAND-LIST;; CASE2) COMMAND-LIST;; ... CASEN) COMMAND-LIST;; esac
    

    It's probably mistaken for zsh syntax:

    case word in [ [(] pattern [ | pattern ] ... ) list (;;|;&|;|) ] ... esac
    

    Sources:

    opened by akeeman 4
  • completions: bash template does not handle sub-commands

    completions: bash template does not handle sub-commands

    $ poetry --version
    Poetry (version 1.2.0b2dev0)
    $ echo $BASH_VERSION
    5.1.16(1)-release
    $ poetry completions bash | bash
    bash: line 40: syntax error near unexpected token `clear'
    bash: line 40: `            (cache clear)'
    

    Originally reported at https://github.com/python-poetry/poetry/issues/4572.

    opened by abn 4
  • 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
  • chore(deps): bump rapidfuzz from 2.13.2 to 2.13.7

    chore(deps): bump rapidfuzz from 2.13.2 to 2.13.7

    Bumps rapidfuzz from 2.13.2 to 2.13.7.

    Release notes

    Sourced from rapidfuzz's releases.

    Release v2.13.7

    Fixed

    • fix function signature of get_requires_for_build_wheel

    Release 2.13.6

    Changed

    • reformat changelog as restructured text to get rig of m2r2 dependency

    Release 2.13.5

    Added

    • added docs to sdist

    Fixed

    • fix two cases of undefined behavior in process.cdist

    Release 2.13.4

    Changed

    • handle float("nan") similar to None for query / choice, since this is common for non-existent data in tools like numpy

    Fixed

    • fix handling on None/float("nan") in process.distance
    • use absolute imports inside tests

    Release 2.13.3

    Fixed

    • improve handling of functions wrapped using functools.wraps
    • fix broken fallback to Python implementation when the a ImportError occurs on import. This can e.g. occur when the binary has a dependency on libatomic, but it is unavailable on the system
    • define CMAKE_C_COMPILER_AR/CMAKE_CXX_COMPILER_AR/CMAKE_C_COMPILER_RANLIB/CMAKE_CXX_COMPILER_RANLIB if they are not defined yet
    Changelog

    Sourced from rapidfuzz's changelog.

    Changelog

    [2.13.7] - 2022-12-20 ^^^^^^^^^^^^^^^^^^^^^ Fixed

    - fix function signature of ``get_requires_for_build_wheel``
    

    [2.13.6] - 2022-12-11 ^^^^^^^^^^^^^^^^^^^^^ Changed

    • reformat changelog as restructured text to get rig of m2r2 dependency

    [2.13.5] - 2022-12-11 ^^^^^^^^^^^^^^^^^^^^^ Added

    * added docs to sdist
    

    Fixed

    • fix two cases of undefined behavior in process.cdist

    [2.13.4] - 2022-12-08 ^^^^^^^^^^^^^^^^^^^^^ Changed

    * handle ``float("nan")`` similar to None for query / choice, since this is common for
      non-existent data in tools like numpy
    

    Fixed

    * fix handling on ``None``\ /\ ``float(&quot;nan&quot;)`` in ``process.distance``
    * use absolute imports inside tests
    

    [2.13.3] - 2022-12-03 ^^^^^^^^^^^^^^^^^^^^^ Fixed

    • improve handling of functions wrapped using functools.wraps
    • fix broken fallback to Python implementation when the a ImportError occurs on import. This can e.g. occur when the binary has a dependency on libatomic, but it is unavailable on the system
    • define CMAKE_C_COMPILER_AR\ /\ CMAKE_CXX_COMPILER_AR\ /\ CMAKE_C_COMPILER_RANLIB\ /\ CMAKE_CXX_COMPILER_RANLIB if they are not defined yet

    [2.13.2] - 2022-11-05 </tr></table>

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies python 
    opened by dependabot[bot] 0
  • Add PowerShell completion generation

    Add PowerShell completion generation

    I'm not an expert in PowerShell or CLI's, but this developments may help someone else complete it Should be called like: script completions PowerShell > $PROFILE If I understand correctly, where PowerShell saves its configurations

    Solves #253

    opened by ZettZet 0
  • Fix terminal sizing for non-tty terminals

    Fix terminal sizing for non-tty terminals

    Closes: python-poetry/poetry#7184

    This fixes the issue, where in Python <3.11 shutil.get_terminal_size() would return (0, 0) size in non-TTY terminals.

    opened by Secrus 5
  • fix: avoid zerodivisionerrors in no-tty usecase

    fix: avoid zerodivisionerrors in no-tty usecase

    Fix for python-poetry/poetry#7184, which discovered that this would lead to ZeroDivisionErrors as columns will be 0 for Python <3.11 running without a TTY.

    opened by TheKevJames 1
Releases(2.0.1)
  • 2.0.1(Nov 22, 2022)

  • 2.0.0(Nov 22, 2022)

    No source code changes.

    This is a version-only release to replace 1.0.0, which was yanked on the grounds that it was incompatible with real dependents (i.e. Poetry) based on their version specifiers, which explicitly included 1.0.0 pre-releases.

    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Nov 22, 2022)

    Key points

    • Supported Python versions are now 3.7 up to 3.11.
    • cleo is now fully type-checked.
    • cleo no longer depends on clikit.

    Changed

    • Replaced Terminal class with shutil.get_terminal_size() from standard library (#175).
    • Exceptions are now Errors (#179).
    • pylev was dropped in favor of much faster rapidfuzz (#173).
    • Default error verbosity was reduced (#132 & #166).

    Removed

    • Removed doc comment-based command configuration notation (#239).

    Fixed

    • --no-interaction is now automatically set when running in non-TTY terminals (#245).
    • Generated completions will no longer cause shell errors for namespaced commands (#247).
    • Using ^C while autocompleting Question answer will no longer break terminal (#240).
    • Namespaced commands no longer reset interactive state (#234).
    • Fixed underlying regex that caused CVE-2022-42966 (#285).
    Source code(tar.gz)
    Source code(zip)
  • 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)
  • 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)
  • v0.4.1(Sep 21, 2016)

  • 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)
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
Corgy allows you to create a command line interface in Python, without worrying about boilerplate code

corgy Elegant command line parsing for Python. Corgy allows you to create a command line interface in Python, without worrying about boilerplate code.

Jayanth Koushik 7 Nov 17, 2022
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 23.6k Dec 31, 2022
Pythonic command line arguments parser, that will make you smile

docopt creates beautiful command-line interfaces Video introduction to docopt: PyCon UK 2012: Create *beautiful* command-line interfaces with Python N

null 7.7k Dec 30, 2022
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 41.4k Jan 2, 2023
A minimal and ridiculously good looking command-line-interface toolkit

Proper CLI Proper CLI is a Python package for creating beautiful, composable, and ridiculously good looking command-line-user-interfaces without havin

Juan-Pablo Scaletti 2 Dec 22, 2022
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 63 Nov 12, 2022
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 13.3k Dec 31, 2022
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 8.1k Dec 30, 2022
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 Dec 21, 2022
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 82 Dec 28, 2022
prompt_toolkit is a 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 8.1k Jan 4, 2023
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 634 Dec 22, 2022
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 3.2k Jan 9, 2023
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 7 Dec 1, 2021
sane is a command runner made simple.

sane is a command runner made simple.

Miguel M. 22 Jan 3, 2023
Terminalcmd - a Python library which can help you to make your own terminal program with high-intellegence instruments

Terminalcmd - a Python library which can help you to make your own terminal program with high-intellegence instruments, that will make your code clear and readable.

Dallas 0 Jun 19, 2022
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 1.1k Jan 8, 2023
A module for parsing and processing commands.

cmdtools A module for parsing and processing commands. Installation pip install --upgrade cmdtools-py install latest commit from GitHub pip install g

null 1 Aug 14, 2022
A CLI tool to build beautiful command-line interfaces with type validation.

Piou A CLI tool to build beautiful command-line interfaces with type validation. It is as simple as from piou import Cli, Option cli = Cli(descriptio

Julien Brayere 310 Dec 7, 2022
🐍PyNode Next allows you to easily create beautiful graph visualisations and animations

PyNode Next A complete rewrite of PyNode for the modern era. Up to five times faster than the original PyNode. PyNode Next allows you to easily create

ehne 3 Feb 12, 2022