Created
February 1, 2024 18:55
-
-
Save ryan-nauman/63c30b1e9aa59619ae1c3b84a14a83dc to your computer and use it in GitHub Desktop.
script kit open project in vscode
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
// Name: Open Project | |
import '@johnlindquist/kit'; | |
import { Dirent } from 'fs'; | |
export type ScriptDir = Dirent & { path: string }; | |
let dir1 = await readdir(home('git/studiox'), { withFileTypes: true }); | |
let dir2 = await readdir(home('git/public'), { withFileTypes: true }); | |
let dirs = [...dir1, ...dir2] | |
.filter((dir) => dir.isDirectory()) | |
.map((dir: ScriptDir) => `${dir.path}/${dir.name}`); | |
let selectedDir = await arg( | |
'Open Project:', | |
dirs.map((dir) => ({ | |
name: dir, | |
description: home('git', dir), | |
value: home('git', dir), | |
})), | |
); | |
edit(selectedDir); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment