Python 3 cmd.Cmd append space after do_function(): completion

405 Views Asked by At

I'm using the cmd.Cmd library for a command line tool that I'm building and am mildly annoyed that using tab to auto-complete a command, the command line is left at the end of the command instead of appending a space to easily facilitate adding arguments.

do_function(self, line):
    print(line)

and

(Cmd)func[TAB] 

gives the user;

"(Cmd)function"

whereas I'd like to see;

"(Cmd)function "

with the space so I can more easily add a value to (in this case) print.

Is there any way to force an appended space after a tab completion? I assume there's an argument I can set in the cmd.Cmd class to force/allow this... but I can't find any documentation on it.

Thanks in advance.

0

There are 0 best solutions below