Skip to content

pashap/click-repl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

click-repl

https://travis-ci.org/click-contrib/click-repl.svg?branch=master

This is experimental, which is why it's not on PyPI

In your click app:

import click
from click_repl import register_repl

@click.group()
def cli():
    pass

@cli.command()
def hello():
    click.echo("Hello world!")

register_repl(cli)

In the shell:

$ my_app repl
> hello
Hello world!
> ^C
$ echo hello | my_app repl
Hello world!

Features not shown:

  • Tab-completion.
  • The parent context is reused, which means ctx.obj persists between subcommands. If you're keeping caches on that object (like I do), using the app's repl instead of the shell is a huge performance win.
  • !-prefix executes shell commands.

You can use the internal :help command to explain usage.

License

Licensed under the MIT, see LICENSE.

About

Subcommand REPL for click apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%