Tuesday, October 27, 2015

how to use proper subcommands in Django 1.8?

I realize that there is a LabelCommand, and that works for some things, but I would like full subcommand capabilities (in this case because I would like to have specific options for specific subcommands).

I can invoke add_subparsers inside of add_arguments, but when it gets to where you take the resulting subparsers object and 'add_parser' it chokes due to an incompatibility in the number of arguments expected.  I dug into the code, and this incompatibility appears to stem from the fact that django's CommandParser requires an extra argument (i.e., the name of the command) from what is given to initialize a new parser.  So, the code trying to create a new parser inside of the add_parser command is feeding it the wrong number of args (it's trying to merely give it the kwargs without the command).

Any direction would be greatly appreciated.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/76bfc5ed-8ce0-4926-a315-dc85199c39a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment