1
0
mirror of https://github.com/Foltik/dotfiles synced 2024-11-24 04:22:50 -05:00
dotfiles/lib/diff.py
2018-12-09 00:46:03 -05:00

12 lines
332 B
Python

import lib.proc as proc
def diff(file1, file2):
cmd = ['diff', '-r', str(file1.resolve()), str(file2.expanduser())]
subproc = proc.exec(cmd)
delta = proc.communicate(subproc, cmd, [0, 1])
ret = str(file1) + ' vs ' + str(file2) + ': '
ret += delta if delta != '' else 'Files are identical.'
return ret