-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multilevel subcommands support to CLI
#334
Comments
A clarification. Two levels of subcommands is currently possible by having multiple classes. For example: from jsonargparse import CLI
class level1_cmd_a:
@staticmethod
def level2_cmd_x(): ...
class level1_cmd_b:
@staticmethod
def level2_cmd_y(): ...
if __name__ == "__main__":
CLI(components=[level1_cmd_a, level1_cmd_b]) Though, easier ways to implement can be added. For example similar to {
"level1_cmd_a": {
"level2_cmd_x": func_x,
},
"level1_cmd_b": {
"level2_cmd_y": func_y,
}
} |
Oh, yes, I missed it, thank you! But how to add more levels? The |
More than two levels currently is only possible by manually creating the |
Would it be possible to support |
Yes. |
Thank you, will look forward to it! |
🚀 Feature request
Currently
jsonargparse.CLI
can handle only one level of subcommands through classes. For example:But there is no easy way to add more subcommands, since embedding a class in another one will cause an error.:
To add more subcommands, you need to use
jsonargparse.ArgumentParser
and implement all the logic manually.Motivation
It would be great to be able to create multilevel subcommands easily.
Pitch
Add multilevel subcommands support to
jsonargparse.CLI
.Alternatives
The text was updated successfully, but these errors were encountered: