#!/usr/bin/env bash this_dir="$(realpath "$(dirname "${BASH_SOURCE[0]}")")" repo_dir="$(cd "$this_dir" && git rev-parse --show-toplevel)" tools_dir="$repo_dir/tools" gen_tag="GENERATED BY $(basename "${BASH_SOURCE[0]}")" function copy_if_not_exist() { src="$1" dest="$2" if [[ ! -e "$src" ]]; then echo "Unable to copy $src to $dest. Source file doesn't exist" exit 1 fi if [[ ! -e "$dest" ]]; then cp "$src" "$dest" fi } # Init bashrc echo "Initializing bashrc" copy_if_not_exist "$this_dir/bashrc" "$HOME/.bashrc" # Init fish config echo "Initializing fish config" fish_cfg_dir="$HOME/.config/fish/" mkdir -p "$fish_cfg_dir" exec "$tools_dir/write_tag_block.sh" \ --tag "$gen_tag" \ --replace \ --in-place \ --file "$fish_cfg_dir/config.fish" \ --text "$(cat "$this_dir/config.fish")"