Created
June 7, 2011 21:29
-
-
Save vlasovskikh/1013219 to your computer and use it in GitHub Desktop.
See graphical diff between your old and .pacnew configs, delete .pacnew if needed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Author: Andrey Vlasovskikh | |
# License: MIT | |
import sys | |
import os | |
import subprocess | |
def main(): | |
if len(sys.argv) != 2: | |
print('usage: pacnew FILE', file=sys.stderr) | |
sys.exit(1) | |
filename = sys.argv[1] | |
pacnew = '{}.pacnew'.format(filename) | |
subprocess.call(['meld', filename, pacnew]) | |
answer = input("delete '{}' [y/N]: ".format(pacnew)) | |
if answer == 'y': | |
os.remove(pacnew) | |
else: | |
raise KeyboardInterrupt | |
if __name__ == '__main__': | |
try: | |
main() | |
except KeyboardInterrupt: | |
print('interrupted', file=sys.stderr) | |
sys.exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment