Running from cli, differences

Hi, I was wondering what are the differences btw running a script from the cli, or from the GUI?

In particular I noticed that modal operators are not executed from the cli (which makes sense). Is there a place where to find more or less detailed information about this behaviour?

In case the question is not completely clear. If I run this script from GUI, it prints:

Running Operator
Modal Counter: 1
Modal Counter: 2
Modal Counter: 3
Modal Counter: 4
Modal Counter: 5
Modal Counter: 6
Modal Counter: 7
Modal Counter: 8
Modal Counter: 9
Modal Counter: 10

Blender quit

But running it from cli prints:

Running Operator

Blender quit

So, the operator is executed, but the modal part is omitted.
Thanks in advance!

It’s difficult to answer exactly what is different when running from the CLI, in general just anything related to the user interface or interactive operations can’t be assumed to work.

Typically for an operation, if it does modal operation that should be implemented in the invoke() method, while the execute() method should be only for non-interactive operation. This distinction is not only for the CLI, but also when adjusting the parameters of an operator afterwards or repeating the operator.

As far as I know the most detailed docs we have are the Python API docs:
https://docs.blender.org/api/2.79b/bpy.types.Operator.html

I see… Thanks for the response!!