openworm / owmeta-core

Core library for owmeta
MIT License
3 stars 2 forks source link

Allow parent command options to be parsed in sub-commands #40

Open mwatts15 opened 2 years ago

mwatts15 commented 2 years ago

The cli_command_wrapper module allows for making the command interface (i.e., OWM and sub-commands) accessible through a command line interface. This interface presents attributes and parameters as command line options, but requires that options which are defined by a "super-command" to precede the introduction of any sub-command. This is, sometimes, inconvenient since we may realize the need for a super-command's options only after we've typed out most of the command, so we have to navigate back to the earlier command to add the options.

Method parameters from super-commands' __call__ methods should not be available on sub-commands under this proposal: this allows to segregate options that only make sense for specific methods from those that are potentially applicable throughout sub-commands.

Recommended approach: define parsers just for options derived from properties and attributes to pass down to the current parser and any sub-parsers.