Python application with both interactive and inline mode

129 Views Asked by At

I am trying to create a Python command-line app, which supports both interactive (currently using Cmd) and inline modes (like Python's python -c). Is there a good way to do it without duplicating the 'line parsing' code?

1

There are 1 best solutions below

0
On BEST ANSWER

Use the Cmd.onecmd method:

Interpret the argument as though it had been typed in response to the prompt.