-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[question] How to use shell plugin to call npx vitepress init #2309
Comments
oof that will be tricky. interacting with tty based cli programs in commands is always pretty hard (outside of tauri as well). What exactly is behind |
behind behind is https://github.com/bombshell-dev/clack/tree/main/packages/prompts below is code url |
i mean, what did you configure in src-tauri/capabilities? I assume |
"identifier": "shell:allow-spawn",
"allow":[{
"name": "bun-init-vitepress",
"cmd": "bun",
"args": ["vitepress", "init"],
"sidecar": false
}] |
okay, and what's the situation if you change that to "identifier": "shell:allow-spawn",
"allow":[{
"name": "bun-init-vitepress",
"cmd": "powershell",
"args": ["bun", "vitepress", "init"],
"sidecar": false
}] (or cmd.exe instead of powershell) |
use powershellthrow the same error "identifier": "shell:allow-spawn",
"allow":[{
"name": "bun-init-vitepress",
"cmd": "powershell",
"args": ["bun", "vitepress", "init"],
"sidecar": false
}] const command = Command.create(
"bun-init-vitepress",
["powershell", "bun", "vitepress", "init"],
{cwd: dir, encoding: "utf-8"}
); use cmd.exe"identifier": "shell:allow-spawn",
"allow":[{
"name": "bun-init-vitepress",
"cmd": "cmd.exe",
"args": ["bun", "vitepress", "init"],
"sidecar": false
}] const command = Command.create(
"bun-init-vitepress",
["cmd.exe", "bun", "vitepress", "init"],
{cwd: dir, encoding: "utf-8"}
);
not throw errors, not execute vitepress init yet |
Sorry my last comment didn't make sense, try this please "identifier": "shell:allow-spawn",
"allow":[{
"name": "bun-init-vitepress",
"cmd": "powershell",
"args": ["-C", "bun vitepress init"],
"sidecar": false
}] const command = Command.create(
"bun-init-vitepress",
["-C", "bun vitepress init"],
{cwd: dir, encoding: "utf-8"}
); I'm not 100% sure but For cmd you need to replace |
throw the same error. |
In that case i think you can't use the Command api. The init.ts file you shared above seems to be simple enough to actually do the same logic in your code directly which would be much easier than trying to make a tty connector that works with clack. |
@FabianLars ok, thanks! |
Vitepress use clack/prompts to ask user input params step by step.
https://vitepress.dev/guide/getting-started#setup-wizard
I use this code to call
npx vitepress init
, but throw errorsThe text was updated successfully, but these errors were encountered: