You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I open a new issue to discuss it and close the original one #108.
shtab use option type to decide completion nargs format in this line, however ActionConfigFile doesn't inherit from any of OPTION_MULTI = _AppendAction, _AppendConstAction, _CountAction, should ActionConfigFile inherit from _AppendAction as it accept python cli.py --config config.yaml --confg config2.yaml?
The text was updated successfully, but these errors were encountered:
tshu-w
changed the title
inherit ActionConfigFile from _AppendAction for better compatible with
inherit ActionConfigFile from _AppendAction for better compatible with shtab
Feb 25, 2022
ActionConfigFile inheriting from _AppendAction would only make sense if somehow it could use part of that class's functionality, e.g. doing super().__init__(...) or super().__call__(...). But there is nothing that can be reused from that class. Adding it just so that shtab handles it in some particular way would be a hack and not a good programing practice. Therefore, I will not do this.
@tshu-w you have suggested doing this but gave no motivation for it. What does it do?
Something that wouldn't be a hack and potential addition in jsonargparse could be:
Though, I don't know if OPTION_MULTI can be considered stable and part of the public API of shtab. Would be better to have an explicit public function to register such things. @casperdcl a comment from you could be useful.
Adding it just so that shtab handles it in some particular way would be a hack and not a good programing practice. Therefore, I will not do this.
Thanks for you reply. I see.
@tshu-w you have suggested doing this but gave no motivation for it. What does it do?
I don't particularly understand what you mean. If I understand correctly, the reason I did this was so that shtab would generate the correct zsh completion function for LightningCLI, since --config takes multiple arguments, but now zsh no longer completes --config after entering it once.
Anyway I understand your idea, and also implemented it like the following way.
I open a new issue to discuss it and close the original one #108.
shtab use option type to decide completion nargs format in this line, however ActionConfigFile doesn't inherit from any of
OPTION_MULTI = _AppendAction, _AppendConstAction, _CountAction
, shouldActionConfigFile
inherit from_AppendAction
as it acceptpython cli.py --config config.yaml --confg config2.yaml
?The text was updated successfully, but these errors were encountered: