-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigs.py
More file actions
executable file
·37 lines (27 loc) · 1.09 KB
/
configs.py
File metadata and controls
executable file
·37 lines (27 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
#ah fuck bash, will learn it one day
import subprocess, os
home = os.getenv('HOME')
def path_exists(path):
return subprocess.call("ls " + path, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0
with open(".bashrc", "r") as new_bashrc:
with open(home + "/.bashrc", "a") as bashrc_orig:
for line in new_bashrc:
bashrc_orig.write(line)
print "Appended to ~/.bashrc"
subprocess.call(["cp", ".tmux.conf", "%s/.tmux.conf" % home])
print "Copied new tmux config to ~/.tmux.conf"
if path_exists('~/.emacs'):
with open(".emacs", "r") as new_emacs:
with open(home + "/.emacs", "a") as emacs_orig:
for line in new_emacs:
emacs_orig.write(line)
print "Appended to ~/.emacs"
else:
subprocess.call(["touch", "%s/.emacs" % home])
with open(".emacs", "r") as new_emacs:
with open(home + "/.emacs", "a") as emacs_orig:
for line in new_emacs:
emacs_orig.write(line)
print "Appended to ~/.emacs"
print "You should restart Bash"