Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 53 lines (46 sloc) 1.53 KB
#!/usr/bin/env python
import os, sys, shutil, os.path as path
NEOVIM = {
'config': 'init.vim',
'location': '~/.config/nvim/init.vim',
}
GIT = {
'config': 'gitconfig',
'location': '~/.gitconfig',
}
BASH = {
'config': 'bashrc',
'location': '~/.bashrc',
}
BASH_ALIASES = {
'config': 'bash_aliases',
'location': '~/.bash_aliases',
}
BASH_EXPORTS = {
'config': 'bash_exports',
'location': '~/.bash_exports',
}
TMUX = {
'config': 'tmux.conf',
'location': '~/.tmux.conf',
}
def copy_config(conf_to_loc=True):
script_location = path.abspath(__file__)
config_directory = path.dirname(script_location)
os.chdir(config_directory)
for conf in (NEOVIM, GIT, BASH, BASH_ALIASES, BASH_EXPORTS, TMUX):
conf_full_path = conf['config']
loc_full_path = path.expanduser(conf['location'])
if conf_to_loc:
print('Copying %s to %s' % (conf_full_path, loc_full_path))
err_msg = 'Config is not at path: %s' % path.abspath(conf_full_path)
assert path.isfile(conf_full_path), err_msg
shutil.copyfile(conf_full_path, loc_full_path)
else:
print('Copying %s to %s' % (loc_full_path, conf_full_path))
err_msg = 'Config is not at path: %s' % path.abspath(loc_full_path)
assert path.isfile(loc_full_path), err_msg
shutil.copyfile(loc_full_path, conf_full_path)
if __name__ == '__main__':
should_reverse = '--reverse' in sys.argv or '-r' in sys.argv
copy_config(conf_to_loc=not should_reverse)