interest in passing functions, not strings for commands?
@jiasli is already working on this.
Since Apr 14, 2020.
- Dominant language
- Python
- Stars
- 358
- Forks
- 101
- PR merge metrics
- No merged PRs in 30d
Description
Having found myself frustrated with argparse, I started looking into Knack for argument parsing.
One of the choices that I'm wondering about in Knack is the choice to specify the command groups with strings, which when used are passed to import_module & a python version independent inspect to get the implementation of the command.
This makes it difficult to use static analysis to verify code using this module, since it's roughly akin to eval.
Additionally, it makes it difficult to programmatically generate a CLI from classes, as it requires going from object instance back to strings for the module and function paths.
Is there any interest in supporting functions rather than strings?
Something akin to:
with CommandGroup(self, "hello") as g:
g.command("world", hello_world_handler)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.