You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, while developing a click-repl tool I realized that if I enter an undefined command I get a UsageError immediately after I hit the space bar. For instance:
python cli.py
<here I enter "whatever" followed by a space>
Unhandled exception in event loop:
File "/Users/mala/envs/jup/lib/python3.9/site-packages/prompt_toolkit/buffer.py", line 1919, in new_coroutine
await coroutine(*a, **kw)
File "/Users/mala/envs/jup/lib/python3.9/site-packages/prompt_toolkit/buffer.py", line 1743, in async_completer
async for completion in async_generator:
File "/Users/mala/envs/jup/lib/python3.9/site-packages/prompt_toolkit/completion/base.py", line 323, in get_completions_async
async for completion in completer.get_completions_async(
File "/Users/mala/envs/jup/lib/python3.9/site-packages/prompt_toolkit/completion/base.py", line 199, in get_completions_async
for item in self.get_completions(document, complete_event):
File "/Users/mala/envs/jup/lib/python3.9/site-packages/click_repl/_completer.py", line 257, in get_completions
self.parsed_ctx = _resolve_context(args, self.ctx)
File "/Users/mala/envs/jup/lib/python3.9/site-packages/click_repl/utils.py", line 46, in _resolve_context
name, cmd, args = command.resolve_command(ctx, args)
File "/Users/mala/envs/jup/lib/python3.9/site-packages/click/core.py", line 1746, in resolve_command
ctx.fail(_("No such command {name!r}.").format(name=original_cmd_name))
File "/Users/mala/envs/jup/lib/python3.9/site-packages/click/core.py", line 684, in fail
raise UsageError(message, self)
Exception No such command 'whatever'.
Press ENTER to continue...
> whatever
I found that surrounding this with a try, catching the exception and setting cmd to None works fine for my personal usage (i.e. it lets me write anything and returns a "no such command" error only when I hit enter), but I am not sure whether this is a desired behavior how this would impact other parts of the repl. What are your suggestions to solve this issue?
The text was updated successfully, but these errors were encountered:
Hi, while developing a click-repl tool I realized that if I enter an undefined command I get a
UsageError
immediately after I hit the space bar. For instance:I found that surrounding this with a try, catching the exception and setting cmd to None works fine for my personal usage (i.e. it lets me write anything and returns a "no such command" error only when I hit enter), but I am not sure whether this is a desired behavior how this would impact other parts of the repl. What are your suggestions to solve this issue?
The text was updated successfully, but these errors were encountered: