StackStorm / st2sdk

This repository contains different utilities and tools which help with the StackStorm integration pack development.
Apache License 2.0
10 stars 11 forks source link

[WIP] voodoo/metagen command #3

Closed manasdk closed 8 years ago

manasdk commented 9 years ago

miserable attempt at integrating metagen

(lol .. named branch meatgen)

manasdk commented 9 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?

manasdk commented 9 years ago

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.

manasdk commented 9 years ago

In 39db472adf839bba3717723e9bf4e752fb591f4c I am using argparse. Not perfect but at least takes away a ton of pain. Makes it quite tolerable.

Kami commented 9 years ago

@manasdk For optional arguments you need to use @options decorator with cmd2.

I will look at the other changes shortly.

manasdk commented 9 years ago

kami : @options is pretty horrible to work with. Pretty much need to duplicate help and type info. I worked around with argparse.

Kami commented 9 years ago

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.

manasdk commented 9 years ago

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.

Kami commented 9 years ago

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.

manasdk commented 8 years ago

fail