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
On the documentation, an example is given for how to implement AliasedGroups
We have a command, which is intended to be run like this
axii workspace add
tab completion should then suggest the package names, which works. However, if there is a typo in the command, the command errors out with an ugly stack-trace if implemented according to the documentation.
axii workspaceTYPO add
~/git/axii$ axii workspaceTYPO add Traceback (most recent call last): File "/home/tobiasjacob/git/axii/axii", line 7, in <module> entry_point() File "/home/tobiasjacob/git/axii/.venv/lib/python3.10/site-packages/click/core.py", line 1134, in __call__ return self.main(*args, **kwargs) File "/home/tobiasjacob/git/axii/.venv/lib/python3.10/site-packages/click/core.py", line 1054, in main self._main_shell_completion(extra, prog_name, complete_var) File "/home/tobiasjacob/git/axii/.venv/lib/python3.10/site-packages/click/core.py", line 1129, in _main_shell_completion rv = shell_complete(self, ctx_args, prog_name, complete_var, instruction) File "/home/tobiasjacob/git/axii/.venv/lib/python3.10/site-packages/click/shell_completion.py", line 49, in shell_complete echo(comp.complete()) File "/home/tobiasjacob/git/axii/.venv/lib/python3.10/site-packages/click/shell_completion.py", line 291, in complete completions = self.get_completions(args, incomplete) File "/home/tobiasjacob/git/axii/.venv/lib/python3.10/site-packages/click/shell_completion.py", line 271, in get_completions ctx = _resolve_context(self.cli, self.ctx_args, self.prog_name, args) File "/home/tobiasjacob/git/axii/.venv/lib/python3.10/site-packages/click/shell_completion.py", line 498, in _resolve_context name, cmd, args = command.resolve_command(ctx, args) File "/home/tobiasjacob/git/axii/armarx_setup/cli/common.py", line 127, in resolve_command return cmd.name # if cmd else None, cmd, argsAttributeError: 'NoneType' object has no attribute 'name'
I suggest one of to changes:
Simply removing the resolve_command function solves the issue. This is porably nicer, since the resolve_command function is nowhere else documented.
defresolve_command(self, ctx, args):
# always return the full command name_, cmd, args=super().resolve_command(ctx, args)
returncmd.name, cmd, args
Or changing the example to
defresolve_command(self, ctx, args):
# always return the full command name_, cmd, args=super().resolve_command(ctx, args)
returncmd.nameifcmdelseNone, cmd, args
solves the issue. Please not, that cmd.name if cmd else None is also implemented in src/click/core.py:1716
The text was updated successfully, but these errors were encountered:
On the documentation, an example is given for how to implement AliasedGroups
We have a command, which is intended to be run like this
axii workspace add
tab completion should then suggest the package names, which works. However, if there is a typo in the command, the command errors out with an ugly stack-trace if implemented according to the documentation.
axii workspaceTYPO add
I suggest one of to changes:
resolve_command
function solves the issue. This is porably nicer, since theresolve_command
function is nowhere else documented.solves the issue. Please not, that
cmd.name if cmd else None
is also implemented in src/click/core.py:1716The text was updated successfully, but these errors were encountered: