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
If a command consists of general options (i.e. options before the command name), click_repl version 2.0 supported modifying them as part of a repl entered command.
Thus, if the app included a general option --verbose and the repl command looks like this "--verbose " click-repl accepted the --verbose general cmd line option.click-repl V2 allowed the use
both the options before the command and of tab-completion for these options and their values if the app code implements the tab-completion.
Right now, using the master branch entering any of these general options in the interactive mode ends up in a series of exceptions as shown below with the option to continue and eventually the command can be entered.
Example follows:
pywbemcli -n mock1
Enter 'help repl' for help, or ':q' to exit pywbemcli or to search history,
Unhandled exception in event loop:
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/buffer.py", line 1933, in new_coroutine
await coroutine(*a, **kw)
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/buffer.py", line 1757, in async_completer
async for completion in async_generator:
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/completion/base.py", line 323, in get_completions_async
async for completion in completer.get_completions_async(
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/completion/base.py", line 199, in get_completions_async
for item in self.get_completions(document, complete_event):
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click_repl/_completer.py", line 257, in get_completions
self.parsed_ctx = _resolve_context(args, self.ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click_repl/utils.py", line 46, in resolve_context
name, cmd, args = command.resolve_command(ctx, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click/core.py", line 1715, in resolve_command
ctx.fail(("No such command {name!r}.").format(name=original_cmd_name))
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click/core.py", line 679, in fail
raise UsageError(message, self)
Exception No such command '-n'.
Press ENTER to continue...
Unhandled exception in event loop:
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/buffer.py", line 1933, in new_coroutine
await coroutine(*a, **kw)
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/buffer.py", line 1757, in async_completer
async for completion in async_generator:
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/completion/base.py", line 323, in get_completions_async
async for completion in completer.get_completions_async(
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/completion/base.py", line 199, in get_completions_async
for item in self.get_completions(document, complete_event):
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click_repl/_completer.py", line 257, in get_completions
self.parsed_ctx = _resolve_context(args, self.ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click_repl/utils.py", line 46, in resolve_context
name, cmd, args = command.resolve_command(ctx, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click/core.py", line 1715, in resolve_command
ctx.fail(("No such command {name!r}.").format(name=original_cmd_name))
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click/core.py", line 679, in fail
raise UsageError(message, self)
Exception No such command '-n'.
Press ENTER to continue...
Unhandled exception in event loop:
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/buffer.py", line 1933, in new_coroutine
await coroutine(*a, **kw)
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/buffer.py", line 1757, in async_completer
async for completion in async_generator:
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/completion/base.py", line 323, in get_completions_async
async for completion in completer.get_completions_async(
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/completion/base.py", line 199, in get_completions_async
for item in self.get_completions(document, complete_event):
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click_repl/_completer.py", line 257, in get_completions
self.parsed_ctx = _resolve_context(args, self.ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click_repl/utils.py", line 46, in resolve_context
name, cmd, args = command.resolve_command(ctx, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click/core.py", line 1715, in resolve_command
ctx.fail(("No such command {name!r}.").format(name=original_cmd_name))
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click/core.py", line 679, in fail
raise UsageError(message, self)
Exception No such command '-n'.
Press ENTER to continue...
pywbemcli> -n mock3ns class enumerate
Usage: pywbemcli [GENERAL-OPTIONS] COMMAND [ARGS] [COMMAND-OPTIONS]
Error: No such command '-n'.
The text was updated successfully, but these errors were encountered:
Since this worked in click-repl version 2.0, this is a serious backward incompatibility and actually makes this new release unusable to at least one of our projects.
I do know of the regression and it means that our projects have to either stay with v2 or put the support of the general options back in ourselves. And with the long times to release things like click-repl, it will probably mean creating a fork or using a vendorzed version of click_repl. I tested this summer with our test suite and failed over a hundred of the test largely because we use the general options in the repl mode (A very simple example the --verbose option).
If a command consists of general options (i.e. options before the command name), click_repl version 2.0 supported modifying them as part of a repl entered command.
Thus, if the app included a general option --verbose and the repl command looks like this "--verbose " click-repl accepted the --verbose general cmd line option.click-repl V2 allowed the use
both the options before the command and of tab-completion for these options and their values if the app code implements the tab-completion.
Right now, using the master branch entering any of these general options in the interactive mode ends up in a series of exceptions as shown below with the option to continue and eventually the command can be entered.
Example follows:
pywbemcli -n mock1
Enter 'help repl' for help, or ':q' to exit pywbemcli or to search history,
Unhandled exception in event loop:
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/buffer.py", line 1933, in new_coroutine
await coroutine(*a, **kw)
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/buffer.py", line 1757, in async_completer
async for completion in async_generator:
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/completion/base.py", line 323, in get_completions_async
async for completion in completer.get_completions_async(
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/completion/base.py", line 199, in get_completions_async
for item in self.get_completions(document, complete_event):
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click_repl/_completer.py", line 257, in get_completions
self.parsed_ctx = _resolve_context(args, self.ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click_repl/utils.py", line 46, in resolve_context
name, cmd, args = command.resolve_command(ctx, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click/core.py", line 1715, in resolve_command
ctx.fail(("No such command {name!r}.").format(name=original_cmd_name))
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click/core.py", line 679, in fail
raise UsageError(message, self)
Exception No such command '-n'.
Press ENTER to continue...
Unhandled exception in event loop:
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/buffer.py", line 1933, in new_coroutine
await coroutine(*a, **kw)
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/buffer.py", line 1757, in async_completer
async for completion in async_generator:
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/completion/base.py", line 323, in get_completions_async
async for completion in completer.get_completions_async(
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/completion/base.py", line 199, in get_completions_async
for item in self.get_completions(document, complete_event):
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click_repl/_completer.py", line 257, in get_completions
self.parsed_ctx = _resolve_context(args, self.ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click_repl/utils.py", line 46, in resolve_context
name, cmd, args = command.resolve_command(ctx, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click/core.py", line 1715, in resolve_command
ctx.fail(("No such command {name!r}.").format(name=original_cmd_name))
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click/core.py", line 679, in fail
raise UsageError(message, self)
Exception No such command '-n'.
Press ENTER to continue...
Unhandled exception in event loop:
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/buffer.py", line 1933, in new_coroutine
await coroutine(*a, **kw)
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/buffer.py", line 1757, in async_completer
async for completion in async_generator:
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/completion/base.py", line 323, in get_completions_async
async for completion in completer.get_completions_async(
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/prompt_toolkit/completion/base.py", line 199, in get_completions_async
for item in self.get_completions(document, complete_event):
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click_repl/_completer.py", line 257, in get_completions
self.parsed_ctx = _resolve_context(args, self.ctx)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click_repl/utils.py", line 46, in resolve_context
name, cmd, args = command.resolve_command(ctx, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click/core.py", line 1715, in resolve_command
ctx.fail(("No such command {name!r}.").format(name=original_cmd_name))
File "/home/kschopmeyer/virtualenvs/pycli311/lib/python3.11/site-packages/click/core.py", line 679, in fail
raise UsageError(message, self)
Exception No such command '-n'.
Press ENTER to continue...
pywbemcli> -n mock3ns class enumerate
Usage: pywbemcli [GENERAL-OPTIONS] COMMAND [ARGS] [COMMAND-OPTIONS]
Error: No such command '-n'.
The text was updated successfully, but these errors were encountered: