Skip to content

Commit 783cd10

Browse files
committed
Fix cleanup process and improve dialogue
1 parent b4e4100 commit 783cd10

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

emacs-config.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,28 +59,43 @@ def install():
5959
else:
6060
choice = raw_input().lower()
6161
if choice in ("yes", "ye", "y"):
62+
shutil.rmtree(settings_dir)
6263
break
6364
elif choice in ("no", "n"):
6465
return
6566
else:
6667
print("Must answer yes or no. Overwrite directory %s?" % settings_dir)
6768

68-
shutil.rmtree(settings_dir)
6969
shutil.copyfile(emacs_backup, emacs_file)
7070
shutil.copytree(settings_backup, settings_dir)
7171

7272

73+
def helptext():
74+
print("emacs-config.py for Python 2.7 and Python 3.x")
75+
print("USAGE: python emacs-config.py [install|update]")
76+
print("Argument instructions:")
77+
print(" install: Installs the emacs configuration files into your Unix user's home folder")
78+
print(" update: Updates the archived configuration with files located in your Unix user's home folder")
79+
80+
7381
if __name__ == "__main__":
7482
for arg in sys.argv:
7583
try:
7684
if arg == "install":
85+
print("Installing Andrew Clarry's emacs configuration")
7786
install()
7887
elif arg == "update":
7988
update()
89+
if arg in ("help", "-h", "--help"):
90+
helptext()
8091
except KeyboardInterrupt:
8192
print("Exiting")
8293
sys.exit(1)
8394

95+
if len(sys.argv) < 2:
96+
print("Please specify what you want done\n")
97+
helptext()
98+
8499

85100

86101

0 commit comments

Comments
 (0)