Files
raycast/sh/open-vscode-remote.sh

41 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Open VSCode Remote
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🖥️
# @raycast.packageName @kevisual/raycast
# Documentation:
# @raycast.description SSH to diana, fuzzy select a project with fzf, then open it in VSCode Remote
# @raycast.author abearxiong
# @raycast.authorURL https://raycast.com/abearxiong
FZF_BIN="fzf"
CMD="ssh diana 'find /root/workspace/projects /root/workspace/docker -maxdepth 1 -type d 2>/dev/null' | $FZF_BIN --prompt='VSCode Remote > ' | xargs -I{} open 'vscode://vscode-remote/ssh-remote+diana{}'"
osascript <<OSASCRIPT
tell application "iTerm"
activate
try
set newWindow to (create window with default profile)
tell newWindow
tell current session
write text "$CMD"
end tell
end tell
on error
tell current window
create tab with default profile
tell current session
write text "$CMD"
end tell
end tell
end try
end tell
OSASCRIPT