-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcheck_extensions.sh
More file actions
executable file
·40 lines (36 loc) · 1.01 KB
/
Copy pathcheck_extensions.sh
File metadata and controls
executable file
·40 lines (36 loc) · 1.01 KB
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
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
#title :check-extensions.sh
#description :List VS Code extensions to file, overwrite if contents is changed
#author :Timothy Merritt
#date :2022-10-18
#version :0.0.1
#usage :./check-extensions.sh
#notes :
#bash_version :5.2.2(1)-release
#============================================================================
# VS Code extension file
vs_ext_file=$HOME/.dotfiles/vscode/extensions.txt
# List VS Code extensions and write to file
write_ext() {
printf "Writing extensions to %s\n" "$vs_ext_file"
sleep .5
code-insiders --list-extensions >"$vs_ext_file"
}
# Main script
main() {
printf "\e[1;33m%-4s\e[mChecking VS Code Extensions\n" "●"
sleep .5
# Check if file exists
if [ -f "$vs_ext_file" ]; then
printf "Writing extensions...\n"
write_ext
else
printf "Extension file does not exist, creating new.\n"
sleep .5
touch "$vs_ext_file"
write_ext
fi
printf "\e[0;32m%-4s\e[mFinished\n" "✔"
exit 0
}
main