mirror of
https://github.com/ryanccn/flake.git
synced 2025-12-06 16:10:45 +01:00
fix(vscode): use full path to CLI and support dry runs
This commit is contained in:
parent
43feb86859
commit
d8df2278e7
1 changed files with 6 additions and 4 deletions
|
|
@ -181,13 +181,15 @@ in {
|
||||||
|
|
||||||
home.activation = {
|
home.activation = {
|
||||||
vscodeExtensions = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
vscodeExtensions = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||||
if ! command -v "code" &> /dev/null; then
|
code_bin="/usr/local/bin/code"
|
||||||
|
|
||||||
|
if ! command -v "$code_bin" &> /dev/null; then
|
||||||
echo "code CLI is not available"
|
echo "code CLI is not available"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
declare -A currentExtensions
|
declare -A currentExtensions
|
||||||
for extension in $(code --list-extensions); do
|
for extension in $("$code_bin" --list-extensions); do
|
||||||
currentExtensions["$extension"]=1;
|
currentExtensions["$extension"]=1;
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
@ -198,7 +200,7 @@ in {
|
||||||
(ext: ''
|
(ext: ''
|
||||||
if [[ -z "''${currentExtensions[${ext}]+unset}" ]]; then
|
if [[ -z "''${currentExtensions[${ext}]+unset}" ]]; then
|
||||||
echo "installing ${ext}"
|
echo "installing ${ext}"
|
||||||
code --install-extension ${ext} &> /dev/null
|
$DRY_RUN_CMD "$code_bin" --install-extension ${ext} &> /dev/null
|
||||||
fi
|
fi
|
||||||
unset 'currentExtensions[${ext}]'
|
unset 'currentExtensions[${ext}]'
|
||||||
'')
|
'')
|
||||||
|
|
@ -207,7 +209,7 @@ in {
|
||||||
|
|
||||||
for ext in "''${!currentExtensions[@]}"; do
|
for ext in "''${!currentExtensions[@]}"; do
|
||||||
echo "uninstalling $ext"
|
echo "uninstalling $ext"
|
||||||
code --uninstall-extension $ext &> /dev/null
|
$DRY_RUN_CMD "$code_bin" --uninstall-extension $ext &> /dev/null
|
||||||
currentExtensions[$ext]=
|
currentExtensions[$ext]=
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue