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)
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 independentinspect
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: