From ec4be28336a1793e633f43f7a35ab5e222b17ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=20G=C3=B3mez?= Date: Tue, 14 Feb 2023 16:28:33 +0100 Subject: [PATCH] feat: export and import vscode extensions --- scripts/package/dump | 3 +++ scripts/package/import | 2 ++ scripts/package/src/dump.sh | 19 ++++++++++++++++--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/scripts/package/dump b/scripts/package/dump index f47af8d7..9b203019 100755 --- a/scripts/package/dump +++ b/scripts/package/dump @@ -6,6 +6,7 @@ source "$DOTLY_PATH/scripts/package/src/dump.sh" ##? Dump all installed packages from: ##? * Brew ##? * Apt +##? * VSCode ##? * Snap ##? * Python ##? * Volta.sh or NPM @@ -23,6 +24,8 @@ platform::command_exists snap && package::snap_dump && output::answer "Snap apps platform::command_exists pip3 && package::python_dump && output::answer "Python apps dumped on $PYTHON_DUMP_FILE_PATH" +platform::command_exists code && package::code_dump && output::answer "VSCode extensions dumped on $CODE_DUMP_FILE_PATH" + if platform::command_exists volta; then package::volta_dump && output::answer "Volta apps dumped on $VOLTA_DUMP_FILE_PATH" elif platform::command_exists npm; then diff --git a/scripts/package/import b/scripts/package/import index 2b053bee..f9f8cdce 100755 --- a/scripts/package/import +++ b/scripts/package/import @@ -22,6 +22,8 @@ platform::command_exists snap && output::header "Importing Snap apps from $SNAP_ platform::command_exists pip3 && output::header "Importing Python apps from $PYTHON_DUMP_FILE_PATH" && package::python_import +platform::command_exists code && output::header "Importing VSCode extensions from $CODE_DUMP_FILE_PATH" && package::code_import + if platform::command_exists volta; then output::header "Importing Volta apps from $VOLTA_DUMP_FILE_PATH" && package::volta_import elif platform::command_exists npm; then diff --git a/scripts/package/src/dump.sh b/scripts/package/src/dump.sh index 705133de..604c00bc 100644 --- a/scripts/package/src/dump.sh +++ b/scripts/package/src/dump.sh @@ -7,12 +7,13 @@ elif platform::is_linux; then fi APT_DUMP_FILE_PATH="$DOTFILES_PATH/os/linux/apt/packages.txt" -SNAP_DUMP_FILE_PATH="$DOTFILES_PATH/os/linux/snap/packages.txt" -PYTHON_DUMP_FILE_PATH="$DOTFILES_PATH/langs/python/requirements.txt" +CODE_DUMP_FILE_PATH="$DOTFILES_PATH/editors/code/extensions.txt" NPM_DUMP_FILE_PATH="$DOTFILES_PATH/langs/js/global_modules.txt" +PACMAN_DUMP_FILE_PATH="$DOTFILES_PATH/os/linux/pacman/packages.txt" +PYTHON_DUMP_FILE_PATH="$DOTFILES_PATH/langs/python/requirements.txt" +SNAP_DUMP_FILE_PATH="$DOTFILES_PATH/os/linux/snap/packages.txt" VOLTA_DUMP_FILE_PATH="$DOTFILES_PATH/langs/js/volta_dependencies.txt" WINGET_DUMP_FILE_PATH="$DOTFILES_PATH/os/windows/winget.output" -PACMAN_DUMP_FILE_PATH="$DOTFILES_PATH/os/linux/pacman/packages.txt" package::brew_dump() { if platform::is_macos; then @@ -43,6 +44,18 @@ package::apt_import() { fi } +package::code_dump() { + mkdir -p "$DOTFILES_PATH/editors/code" + + code --list-extensions >"$CODE_DUMP_FILE_PATH" +} + +package::code_import() { + mkdir -p "$DOTFILES_PATH/editors/code" + + xargs -I_ code --install-extension _ --force <"$CODE_DUMP_FILE_PATH" +} + package::snap_dump() { mkdir -p "$DOTFILES_PATH/os/linux/snap"