click-repl icon indicating copy to clipboard operation
click-repl copied to clipboard

Adding more documentation

Open FergusFettes opened this issue 2 years ago • 3 comments

Am I right in thinking that the README is the only documentation for this project?

It seems like there are a lot of cool features that are undocumented, for example:

  • Customizing Prompts: https://github.com/click-contrib/click-repl/issues/7
  • Adding 'help': https://github.com/click-contrib/click-repl/issues/9

And I'm also wondering if there is some way to make the repl run by default-- thats how it works in click-shell and its quite a nice feature (so you don't always need to write 'command repl').

Great project though! Just a touch more documentation would be super cool.

FergusFettes avatar May 05 '23 08:05 FergusFettes

As u can see, click-shell uses its custom click.Group-like class to run the CLI app And also as u said, u can run your repl by default like this

# file.py
import click
from click_repl import register_repl

@click.group(invoke_without_command=True)
@click.pass_context
def cli(ctx):
    if ctx.invoked_subcommand is None:
        click_repl.repl(ctx)

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

cli()
$ python file.py
> # prompts for input

This only works if u run/execute ur CLI app by invoking only its main CLI group, doesn't work for subcommands like that

GhostOps77 avatar May 13 '23 18:05 GhostOps77

I would actually say that its like giving permission to the dev to run repl whenever they want. Its not like they have to execute right after the moment they call the group

By this implementation, they can even run repl at certain condition if defined

Also, I agree that the documentation is incomplete. A PR for that would be nice

GhostOps77 avatar May 21 '23 09:05 GhostOps77

I decided to go with click-shell for the moment and even made a version for typer: https://github.com/fergusfettes/typer-shell

I am interested in what this package does differently so maybe one day I come back to this, and if I do I will do some documentation. But for now I'm working on typer-shell things.

FergusFettes avatar May 23 '23 09:05 FergusFettes