{% set plus = 0 %} {% set minus = 0 %} {% set total_change = 0 %} {% for line in stdout %} {% if loop.index0 == 0 %}
{{ line }}
{% elif loop.index0 == 1 %} {{ line }}
{% elif line.startswith('-') and loop.index0 > 1 %}
{{ line }}
{% set minus = minus + 1 %} {% elif line.startswith('+') and loop.index0 > 2 %}
{{ line }}
{% set plus = plus + 1 %} {% elif line.startswith('@') %}
{{ line }}
{% else %}
{{ line }}
{% endif %} {% set total_change = minus + plus %} {% if loop.last %}
Total change: {{ total_change }}, additions: {{ plus }} & deletions: {{ minus }}
{% endif %} {% endfor %}