I am writing a python command line interface tool on top of cement . Cement works well enough for standard argument analysis. However, I want to be able to add a certain number of arguments without a flag. Let me explain.
A typical command line tool:
cmd subcmd -flag -stored=flag
Now, let's say I want to add some arguments without flags, like how cd works
cd my/dir
my/dir is an argument without a flag.
Is there anyway to do this with cement?
My current cement application example:
class MyAppBaseController(controller.CementBaseController):
class Meta:
label = 'base'
interface = controller.IController
description = "My Application Does Amazing Things"
arguments = [
(['--base-opt'], dict(help="option under base controller")),
]
@controller.expose(help="base controller default command", hide=True)
def default(self):
self.app.args.parse_args(['--help'])
print "Inside MyAppBaseController.default()"
@controller.expose(help="another base controller command")
def command1(self):
print "Inside MyAppBaseController.command1()"
So let's say I wanted to do myapp command1 some/dir some_string
Is there any way to analyze these arguments?
source
share