Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
moukoublen committed Jan 7, 2025
1 parent 8bef821 commit 842a1a7
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions config/vscode/install-config
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
#!/usr/bin/env bash

SRC="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

CONF_PATH="${HOME}/.config/Code/User"
if [[ $(uname) == "Darwin" ]]; then
CONF_PATH="${HOME}/Library/Application Support/Code/User/"
fi
mkdir -p "${CONF_PATH}"

SELF_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

__install_settings_file() {
local cnf_file=$1
local trg_file=${2:-${cnf_file}}

local ORIGIN="${SELF_PATH}/${cnf_file}"
local TARGET="${CONF_PATH}/${trg_file}"

# if file exists, backup.
[[ -f ${TARGET} ]] && [[ ! -L ${TARGET} ]] && mv "${TARGET}"{,.backup}

# if link already exists, return.
[[ -L ${TARGET} ]] && echo "Link for ${cnf_file} already exists" && return

# install sym link
echo -e "Linking \e[0;35m${ORIGIN}\e[0m -> \e[0;36m${TARGET}\e[0m"
ln -s "${ORIGIN}" "${TARGET}"
}
lnx "${SRC}/settings.json" "${CONF_PATH}/settings.json"

__install_settings_file settings.json
if [[ $(uname) == "Linux" ]]; then
__install_settings_file keybindings.json
lnx "${SRC}/keybindings.json" "${CONF_PATH}/keybindings.json"
fi

0 comments on commit 842a1a7

Please sign in to comment.