microsoft / microsoft/knack

CLICommandsLoader.create_command overrides the argument "arguments_loader"

Open
#219 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
358
Forks
101
PR merge metrics
No merged PRs in 30d

Description

Issue here: https://github.com/microsoft/knack/blob/dc7b7d857ce3c11b2a3155b81f2470b3b579e7c9/knack/commands.py#L265

The whole command registration process suggests that it is possible to give a custom arguments loader when calling the command method in a CommandGroup context. However, this parameter is overwritten with something else in the CLICommandsLoader.create_command method making impossible to pass a custom arguments_loader.

The same is true for the argument description_loader.

What was the behavior expected here? Shouldn't the arguments_loader from kwargs supersede the default one?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in knack/commands.py around CLICommandsLoader.create_command at the linked line, then trace how CommandGroup.command passes arguments_loader and description_loader. Confirm whether the supplied loaders are replaced during registration, and verify completion by covering custom-loader registration without breaking the default behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.