diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/clean | 9 | ||||
-rwxr-xr-x | bin/dot | 42 | ||||
-rwxr-xr-x | bin/install | 9 | ||||
-rwxr-xr-x | bin/vimin | 4 |
4 files changed, 24 insertions, 40 deletions
diff --git a/bin/clean b/bin/clean deleted file mode 100755 index 19a0455..0000000 --- a/bin/clean +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/bash -dotdir=/home/urbain/dotfiles && cd $dotdir -for file in `ls -A --ignore="Makefile" --ignore="README.md" --ignore=".git*"`; do - if [[ -f $file/Makefile ]]; then - cd $file && make clean && cd $dotdir - else - rm -f $HOME/$file - fi -done @@ -7,51 +7,49 @@ import yaml # Colors for terminal from termcolor import colored - # Path of dotfiles -dotpath = '/home/urbain/dotfiles' +homepath = '/home/urbain' +dotpath = homepath + '/dotfiles' # Load yaml configuration file with open(dotpath + "/install.yaml", 'r') as stream: config = yaml.load(stream) -# Special symlinks +# Special and default symlinks special_symlinks = set(config['special'].keys()) - -# All files in dir -normal_symlinks = set(os.listdir(dotpath)) - set(config['exclude']) +normal_symlinks = set(config['default']) def perform(action): - # Command to execute - command = config['commands'][action] - for f in special_symlinks | normal_symlinks: # Print filename print('[' + colored(f, 'green') + ']') - if f in config['pre']: - print(config['pre'][f]) - os.system(config['pre'][f]) + if f in config['pre'] and action == 'up': + + # Format command + command = config['pre'][f] + formatted = command.format(file=f, path=dotpath) + + # Print & execute + print(formatted) + os.system(formatted) # Target of symlink if f in special_symlinks: t = config['special'][f] elif f in normal_symlinks: - t = config['default'].format(file=f) - - if t != "": - # Formatted command - formatted = command.format(file=f, path=dotpath, target=t) + t = homepath + '/' + f - # Print & execute command - print(formatted) - os.system(formatted) + # Command to execute + command = config['commands'][action] + formatted = command.format(file=f, path=dotpath, target=t) - else: - print("Nothing to do!") + # Print & execute command + print(formatted) + os.system(formatted) print('\n') diff --git a/bin/install b/bin/install deleted file mode 100755 index bc21136..0000000 --- a/bin/install +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/bash -dotdir=/home/urbain/dotfiles && cd $dotdir -for file in `ls -A --ignore="Makefile" --ignore="README.md" --ignore=".git*"`; do - if [[ -f $file/Makefile ]]; then - cd $file && make && cd $dotdir - else - rm -f $HOME/$file && ln -s $dotdir/$file $HOME/$file - fi -done diff --git a/bin/vimin b/bin/vimin new file mode 100755 index 0000000..905b30f --- /dev/null +++ b/bin/vimin @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +tempfile=$(mktemp) +urxvt -e vim ${tempfile} +cat ${tempfile} | xclip -i |