Created
January 7, 2024 07:50
-
-
Save book000/8c23a1c2948a3a2be9fc20710ff004a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function devopen() { | |
local workspace_folder="$(readlink -f "$1")" | |
if [ -d "$workspace_folder" ]; then | |
local wsl_path="$(wslpath -w "$workspace_folder")" | |
local path_id=$(printf "%s" "$wsl_path" | xxd -ps -c 256) | |
code --folder-uri "vscode-remote://dev-container%2B${path_id}/workspaces/$(basename "$workspace_folder")" | |
else | |
echo "Usage: devopen <directory>" 1>&2 | |
echo "" 1>&2 | |
echo "Error: Directory ${1@Q} does not exist" 1>&2 | |
false | |
fi | |
} | |
devopen $* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment