We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementer help sought - start with click_repl (this is where some examples would assist)
Seek to connect the text of an input to executing a click command in a app level repl from a prompt
I see from the readme for an advanced usage ... this is from here.
import click from click_repl import repl from prompt_toolkit.history import FileHistory @click.group() def cli(): pass @cli.command() def mycli(): # name changed from readme prompt_kwargs = { 'history': FileHistory('.mycli_history'), } repl(click.get_current_context(), prompt_kwargs=prompt_kwargs) cli()
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
import click from click_repl import repl from prompt_toolkit import PromptSession from prompt_toolkit.history import FileHistory import cmdcomplete # custom local def cliprompt(): """Main. Build an SQLite REPL Tutorial""" session = PromptSession( completer=cmdcomplete.nest_auto, history=FileHistory('.mycli-history')) while True: try: text = session.prompt('PyCriteria > ') except KeyboardInterrupt: continue except EOFError: break else: return text print('GoodBye!')
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
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)
The text was updated successfully, but these errors were encountered:
Some of this a rough, WIP, and not meant to technically accurate, it is the conceptual freeze that is hurting
BTW I be happy to do some technical writing for examples and drink the champagne as a give back/contrib
Sorry, something went wrong.
No branches or pull requests
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
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)
The text was updated successfully, but these errors were encountered: