Closed manasdk closed 8 years ago
kami - maybe there is a better way to do this but I was unable to get positional and optional args to mix with cmd2. Any idea?
The only alternative I can come up with is to completely ignore the @options and apply argparse on the input to the do_metagen method.
In 39db472adf839bba3717723e9bf4e752fb591f4c I am using argparse. Not perfect but at least takes away a ton of pain. Makes it quite tolerable.
@manasdk For optional arguments you need to use @options
decorator with cmd2.
I will look at the other changes shortly.
kami : @options
is pretty horrible to work with. Pretty much need to duplicate help and type info. I worked around with argparse.
I'm fine with using argparse as long as we use it consistency across the code base.
I know this is just a quick port so I'm fine with not refactoring any code right now, but eventually, we should build some more common building blocks so maintaining this tool and adding new commands will be easy and painless.
I'm fine with using argparse as long as we use it consistency across the code base.
I was too optimistic about argparse and using it the way I did; it doesn't actually work. Not sure what the heck happened.
Did you figure out the argparse stuff?
If not, I think usingsys.argv
here data = self._get_args_parser_metagen().parse_args(args)
instead of args
might work.
miserable attempt at integrating metagen
(lol .. named branch meatgen)