MCPcopy Create free account
hub / github.com/VSCodeConfigHelper/v4 / vscode

Function vscode

src-tauri/src/cli/prompt.rs:10–34  ·  view source on GitHub ↗
(arg: Option<String>, y: bool)

Source from the content-addressed store, hash-verified

8use crate::steps::workspace;
9
10pub fn vscode(arg: Option<String>, y: bool) -> Result<String> {
11 if let Some(origin) = arg {
12 match vscode::verify(&origin) {
13 Err(e) => Err(anyhow!("VS Code 验证失败:{}", e)),
14 Ok(_) => Ok(origin),
15 }
16 } else {
17 let scanned = vscode::scan();
18 if y {
19 match scanned {
20 Some(v) => Ok(v),
21 None => Err(anyhow!("未找到已安装的 VS Code")),
22 }
23 } else {
24 let mut builder = Question::input("vscode")
25 .message("VS Code 路径:")
26 .validate_on_key(|s, _| vscode::verify(s).is_ok())
27 .validate(|s, _| vscode::verify(s).map_err(|s| format!("验证失败:{}", s)));
28 if let Some(dft) = vscode::scan() {
29 builder = builder.default(dft);
30 }
31 Ok(prompt_one(builder.build())?.as_string().unwrap().into())
32 }
33 }
34}
35
36pub fn setup(arg: Option<&'static CompilerSetup>, y: bool) -> Result<&'static CompilerSetup> {
37 if y {

Callers 1

cliFunction · 0.85

Calls 2

verifyFunction · 0.50
scanFunction · 0.50

Tested by

no test coverage detected