-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvscode.exclude.sh
30 lines (23 loc) · 1.01 KB
/
vscode.exclude.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# This script needs to be run as bash (not sh) due to use of <()
# Inspired by Michael Anhari's ruby script for the same purpose https://michaelanhari.com/blog/saving-vscode-settings-in-your-dotfiles
source .aliases
if [ -z 'which code' ] ; then
echo "VS Code installation not found. Cannot install extensions."
else
code_extensions=$(cat $PWD/vscode/vscode_extensions|sort)
installed_extensions=$( code --list-extensions|sort);
uninstalled_extensions=$(comm -23 <( echo "$code_extensions") <(echo "$installed_extensions"))
printf "Checking for uninstalled VSCode extensions... "
if [ -z "$uninstalled_extensions" ] ; then
printf "all good! No uninstalled extensions. \n"
else
count=$(echo "$uninstalled_extensions" | wc -w)
printf "found $count.\n" | xargs
for extension in $(echo "$uninstalled_extensions" ) ; do
echo "Installing $extension..."
code --install-extension "$extension"
done
echo "Done!"
fi
fi