Oleksandr Smirnov
Oleksandr Smirnov
olexsmir@gmail.com todo: add todo.txt cli's config, 11 months ago
olexsmir@gmail.com todo: add todo.txt cli's config, 11 months ago
| 1 | #!/usr/bin/env bash |
| 2 | set -e |
| 3 | |
| 4 | # the path to dir where the script and dotfiles are located |
| 5 | # set to specific path so this script can be run from anywhere |
| 6 | dotfilesPath="$HOME/.dotfiles" |
| 7 | |
| 8 | h() { # ln -sf and logs path |
| 9 | ln -sf "$1" "$2" |
| 10 | echo "[ln] $2" |
| 11 | } |
| 12 | |
| 13 | mkd() { # mkdir -p and logs path |
| 14 | mkdir -p "$1" |
| 15 | echo "[mkdir] $1" |
| 16 | } |
| 17 | |
| 18 | create_links_in_dir_recursively() { |
| 19 | local base_dir="$dotfilesPath/$1" |
| 20 | local target_dir="$2" |
| 21 | |
| 22 | find "$base_dir/" -type d | while read -r dir; do |
| 23 | mkd "$HOME/$target_dir${dir#"$base_dir"}" |
| 24 | find "$dir" -maxdepth 1 -type f | while read -r file; do |
| 25 | h "$file" "$HOME/$target_dir${file#"$base_dir"}" |
| 26 | done |
| 27 | done |
| 28 | } |
| 29 | |
| 30 | h "$dotfilesPath/zshrc" "$HOME/.zshrc" |
| 31 | h "$dotfilesPath/gitconfig" "$HOME/.gitconfig" |
| 32 | h "$dotfilesPath/tmux.conf" "$HOME/.tmux.conf" |
| 33 | |
| 34 | mkd "$HOME/bin/" |
| 35 | find "$dotfilesPath/bin" -type f -exec ln -sf {} "$HOME/bin/" \; |
| 36 | |
| 37 | create_links_in_dir_recursively "todo.actions.d" ".todo.actions.d" |
| 38 | |
| 39 | create_links_in_dir_recursively "config" ".config" |
| 40 | h "$dotfilesPath/config/alacritty.yml" "$HOME/.config/alacritty.yml" |
| 41 | h "$dotfilesPath/config/electron-flags.conf" "$HOME/.config/electron-flags.conf" |
| 42 | h "$dotfilesPath/config/starship.toml" "$HOME/.config/starship.toml" |