aboutsummaryrefslogtreecommitdiff
path: root/gn3/computations/diff.py
blob: 4bbc6cff9f93efe8ef2d1f729f154526f360589e (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