aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations/diff.py
blob: 0b6edd60aec4584489ddcb6e678036c8dba2675f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
"""This module contains code that's used for generating diffs"""
from typing import Optional

from gn3.commands import run_cmd


def generate_diff(data: str, edited_data: str) -> Optional[str]:
    """Generate the diff between 2 files"""
    results = run_cmd(f'"diff {data} {edited_data}"', success_codes=(1, 2))
    if results.get("code", -1) > 0:
        return results.get("output")
    return None