show CmdActions as they are executed??

102 views
Skip to first unread message

Tim Docker

unread,
May 31, 2017, 2:27:07 AM5/31/17
to python-doit
I'm enjoying using doit for task automation, and find that running doit with -v2 is useful to see execution details.

Is there a way to show the actual commands executed in subprocesses?

ie for a trivial task like:


def task_genmodel():
    return {
        'doc' : 'regenerate the data model',
        'actions': ['../tools/gen-model.sh'],
    }


I'd like to see the string ../tools/gen-model.sh in the verbose output. Is this possible?

Tim

Eduardo Schettino

unread,
Jun 5, 2017, 7:17:00 AM6/5/17
to python-doit
Hi Tim,

Yes. It is possible to show command action as they are executed. But this is controlled is orthogonal with the verbosity option.

In the task dictionary metadata you can specify a `title` callback, the default one return just the task name.
See: http://pydoit.org/tasks.html#title

Since show the actions is a common use-case it is already implemented in `tools.title_with_actions`.
See: http://pydoit.org/tools.html#title-with-actions-title

Another way would be to write a custom Reporter. See: http://pydoit.org/cmd_run.html#custom-reporter

I think there is a few things that could be improved if you are anyone else is keen to contributing.
 * to change the default "title", as of today you need to modify every task...
 * if task has multiple actions it would be nice to print one by one as the are executed (`title_with_actions` will just print all of them before the execution starts.

Regards,
  Eduardo

--
You received this message because you are subscribed to the Google Groups "python-doit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-doit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages