and my sample/random subcommands from click are, and assume these are in the nest_auto completer
import click
@click.group()
def cli():
pass
@click.command()
def mycli():
"""MyCli"""
prompt_kwargs = {
'history': FileHistory('.mycli-history'),
}
repl(click.get_current_context(), prompt_kwargs=prompt_kwargs)
@click.command()
@click.option('--arg1', required=True, help='This is argument 1')
@click.option('--arg2', required=True, help='This is argument 2')
def subcmd1(arg1, arg2):
print(f'Subcommand 1 with arg1={arg1} and arg2={arg2}')
@click.command()
@click.option('--arg3', required=True, help='This is argument 3')
@click.option('--arg4', required=True, help='This is argument 4')
def subcmd2(arg3, arg4):
print(f'Subcommand 2 with arg3={arg3} and arg4={arg4}')
cli.add_command(mycli)
mycli.add_command(subcmd1)
So My question is giving me a brain freeze / starter burn
1) How do I wire up the following so I get the instruction to execute a click command from a prompt_toolkit string input.... ?
2) I am running my app like this (screenshot)
3) The logical map of subcommands is the larger screenshot.
if __name__ == '__main__':
prompttext = cliprompt()
repl(cli, prompt=prompttext) # as pycharm inspector says Unexpected argument
But I don't know how to link the prompt input to a click command to be fired
The nested command structure is as per AWS command structure
base command subcommand (this last entry is the function caller)
Implementer help sought - start with click_repl (this is where some examples would assist)
I see from the readme for an advanced usage ... this is from here.
From Prompt_toolkit, I got me a working nested command structure (str only) This is from their SQL Tutorial https://python-prompt-toolkit.readthedocs.io/en/stable/pages/tutorials/repl.html
and my sample/random subcommands from click are, and assume these are in the nest_auto completer
So My question is giving me a brain freeze / starter burn
1) How do I wire up the following so I get the instruction to execute a click command from a prompt_toolkit string input.... ? 2) I am running my app like this (screenshot) 3) The logical map of subcommands is the larger screenshot.
But I don't know how to link the prompt input to a click command to be fired
The nested command structure is as per AWS command structure base command subcommand (this last entry is the function caller)
![image](https://github.com/click-contrib/click-repl/assets/51715025/2447ca33-d173-4b3e-a509-cecf1d019935)