Skip to content
New issue

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

fix: corrected click context management in TutorCli, resolves #14 #13

Merged

Conversation

Abdul-Muqadim-Arbisoft
Copy link
Contributor

Removed manual patching of TutorCli object to address an issue where click_repl incorrectly accessed the commands attribute. This patch previously enabled nested shell functionality, which introduced complexity and unexpected behavior.

@Abdul-Muqadim-Arbisoft Abdul-Muqadim-Arbisoft added the bug Something isn't working label Feb 28, 2024
@Abdul-Muqadim-Arbisoft Abdul-Muqadim-Arbisoft changed the title Corrected Click context management in TutorCli Corrected Click context management in TutorCli, resolves #14 Feb 28, 2024
@regisb
Copy link
Contributor

regisb commented Feb 28, 2024

Can you please share evidence that this particular piece of code was causing issues for you, such as logs?

@Abdul-Muqadim-Arbisoft
Copy link
Contributor Author

Abdul-Muqadim-Arbisoft commented Feb 28, 2024

Can you please share evidence that this particular piece of code was causing issues for you, such as logs?

Following is what I am getting over webui interface

Welcome to the Tutor interactive shell UI!
Type "help" to view all available commands.
Type "local launch" to configure and launch a new platform from scratch.
Type <ctrl-d> to exit.
> help
Usage: tutor [OPTIONS] COMMAND [ARGS]...

Error: No such command 'help'.

Unhandled exception in event loop:
  File "/Users/abdul.muqadim/tutor_quince/venv/lib/python3.12/site-packages/prompt_toolkit/buffer.py", line 1920, in new_coroutine
    await coroutine(*a, **kw)
  File "/Users/abdul.muqadim/tutor_quince/venv/lib/python3.12/site-packages/prompt_toolkit/buffer.py", line 1744, in async_completer
    async for completion in async_generator:
  File "/Users/abdul.muqadim/tutor_quince/venv/lib/python3.12/site-packages/prompt_toolkit/completion/base.py", line 323, in get_completions_async
    async for completion in completer.get_completions_async(
  File "/Users/abdul.muqadim/tutor_quince/venv/lib/python3.12/site-packages/prompt_toolkit/completion/base.py", line 199, in get_completions_async
    for item in self.get_completions(document, complete_event):
  File "/Users/abdul.muqadim/tutor_quince/venv/lib/python3.12/site-packages/click_repl/_completer.py", line 257, in get_completions
    self.parsed_ctx = _resolve_context(args, self.ctx)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/abdul.muqadim/tutor_quince/venv/lib/python3.12/site-packages/click_repl/utils.py", line 46, in _resolve_context
    name, cmd, args = command.resolve_command(ctx, args)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/abdul.muqadim/tutor_quince/venv/lib/python3.12/site-packages/click/core.py", line 1746, in resolve_command
    ctx.fail(_("No such command {name!r}.").format(name=original_cmd_name))
  File "/Users/abdul.muqadim/tutor_quince/venv/lib/python3.12/site-packages/click/core.py", line 684, in fail
    raise UsageError(message, self)

Exception No such command 'local'.
Press ENTER to continue... 

It doesn't recognize help command as well as when I want to enter local start, after writing local and pressing spacebar it throws exception, as seen in above logs

@regisb
Copy link
Contributor

regisb commented Mar 21, 2024

Hina has approved this PR, so I'm not sure why my input is needed here? Just make sure to add a changelog entry and squash your commits.

@Abdul-Muqadim-Arbisoft Abdul-Muqadim-Arbisoft changed the title Corrected Click context management in TutorCli, resolves #14 fix: corrected click context management in TutorCli, resolves #14 Mar 26, 2024
@hinakhadim hinakhadim merged commit 0fd491d into overhangio:master Mar 26, 2024
1 check passed
@regisb regisb deleted the muqadim/fix-click-context-management branch March 27, 2024 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging this pull request may close these issues.

3 participants