From 804028782af9bdebfa6b3275d3b85a6aca3af653 Mon Sep 17 00:00:00 2001 From: Brian Ketelsen Date: Sat, 17 Feb 2024 13:33:07 -0500 Subject: [PATCH] feat: vscode-distrobox script --- usr/bin/vscode-distrobox | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 usr/bin/vscode-distrobox diff --git a/usr/bin/vscode-distrobox b/usr/bin/vscode-distrobox new file mode 100755 index 00000000000..ea62fcb072f --- /dev/null +++ b/usr/bin/vscode-distrobox @@ -0,0 +1,14 @@ +#!/bin/sh + +container_name="$(printf '{"containerName":"%s"}' "$1" | od -A n -t x1 | tr -d "\n\t ")" + +if flatpak list | grep -q com.visualstudio.code; then + code_command="flatpak run com.visualstudio.code" +elif command -v code 2> /dev/null > /dev/null; then + code_command="code" +else + echo "vscode not installed" + exit 127 +fi + +${code_command} --folder-uri="vscode-remote://attached-container+${container_name}/${2}"