mirror of
https://github.com/Foltik/dotfiles
synced 2024-11-24 12:26:05 -05:00
Add diff option
This commit is contained in:
parent
1d42aab37e
commit
f9bd5e6a7b
@ -65,7 +65,9 @@ if __name__ == '__main__':
|
|||||||
('-e', '--enable-units', deploy.enable_units, 'enable package units'),
|
('-e', '--enable-units', deploy.enable_units, 'enable package units'),
|
||||||
('-C', '--import-config', deploy.import_config, 'import package config'),
|
('-C', '--import-config', deploy.import_config, 'import package config'),
|
||||||
('-U', '--import-units', deploy.import_units, 'import package units'),
|
('-U', '--import-units', deploy.import_units, 'import package units'),
|
||||||
('-l', '--dump', dump, 'dump package attributes')
|
('-l', '--dump', dump, 'dump package attributes'),
|
||||||
|
('-Dc', '--diff-config', deploy.diff_config, 'diff local and repo config'),
|
||||||
|
('-Du', '--diff-units', deploy.diff_units, 'diff local and repo units')
|
||||||
]
|
]
|
||||||
|
|
||||||
for action in actions:
|
for action in actions:
|
||||||
|
11
lib/diff.py
Normal file
11
lib/diff.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
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
|
Loading…
Reference in New Issue
Block a user