keripy icon indicating copy to clipboard operation
keripy copied to clipboard

Fix kli base file to allow for common arguments across all commands

Open pfeairheller opened this issue 2 years ago • 2 comments

For example, we have --base and --name that apply to most commands. We want a way to define them once and not in every command.

pfeairheller avatar May 16 '23 18:05 pfeairheller

This might be helpful. Since we use multicommand which just uses vanilla argparse it should be possible to add a common set of argparse actions to all commands. Just put them in a file that multi-command does not see and at the top of the multi-command hierarchy add the parseactions to whatever multicommand produces.

https://stackoverflow.com/questions/38050873/can-two-python-argparse-objects-be-combined

SmithSamuelM avatar May 16 '23 22:05 SmithSamuelM

Was think more about this while driving.

I think a programmable approach is needed that allows the use of arguments to be declarative per command. So something like one function with all possible common commands and optional parameters to declare which ones you want in your command.

So like

options(args, base=True, head=True)

Because some commands actually don't use any common ones like saidify and many use --alias but a significant subset do not.

pfeairheller avatar May 16 '23 23:05 pfeairheller