I have the following situation:
import sys
from cmd2 import Cmd, make_option, options
class DemoApp(Cmd):
"""Simple command processor example."""
@options([make_option('-n', '--name', action="store", help="your name"),
])
def do_hello(self, command, opts):
if opts.name:
sys.stdout.write('Hello %s\n' % opts.name)
else:
sys.stdout.write('Hello Nobody\n')
if __name__ == '__main__':
DemoApp().cmdloop()
I want to pass a string with spaces as paramater for option -n. (while in the cmd2 promt)
example:
->hello -n 'My awesome name'
when I do that it is printed:
Hello 'My
the same also with double quotes
so it does not accept spaces there. Does anybody know how to do that?
I figured out was it happening. I submitted a bug in : https://bitbucket.org/catherinedevlin/cmd2/issues?status=new&status=open
plus a patch that fixes the bug. If someone has the same issue you can use the patch if the maintainer does not update the code.