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

Function cli

src-tauri/src/cli/mod.rs:155–234  ·  view source on GitHub ↗
(mut args: CliArgs)

Source from the content-addressed store, hash-verified

153}
154
155fn cli(mut args: CliArgs) -> Result<()> {
156 if args::early_exit(&args) {
157 return Ok(());
158 };
159
160 if !cfg!(windows) {
161 fn nonsupport_check(name: &'static str, flag: &mut bool) {
162 if *flag {
163 warn!("{} 选项在此操作系统上不支持,已忽略。", name);
164 *flag = false;
165 }
166 }
167 nonsupport_check("--ascii-check", &mut args.ascii_check);
168 nonsupport_check("--no-set-env", &mut args.no_set_env);
169 nonsupport_check("--desktop-shortcut", &mut args.desktop_shortcut);
170 }
171
172 info!("检查 VS Code 安装...");
173 let vscode = prompt::vscode(args.vscode, args.assume_yes)?;
174 info!("VS Code 安装在 {},", vscode);
175
176 let setup = prompt::setup(args.setup, args.assume_yes)?;
177
178 info!("验证 {} 类型编译器...", setup.id);
179 let compiler = prompt::compiler(setup, args.compiler, args.assume_yes)?;
180 info!("编译器路径为 {}。", compiler.path);
181
182 info!("检查工作区路径...");
183 let workspace = prompt::workspace(args.workspace, args.assume_yes)?;
184 info!("工作区路径为 {}。", workspace);
185
186 let language = if args.language == Language::Cpp {
187 "C++"
188 } else {
189 "C"
190 };
191 let add_to_path = !args.no_set_env;
192 let test = if args.test {
193 Some(true)
194 } else if args.no_test {
195 Some(false)
196 } else {
197 None
198 };
199
200 let task_init_args = tasks::TaskInitArgs {
201 vscode: vscode,
202 workspace: workspace,
203 compiler: compiler,
204 options: Options {
205 language: language.into(),
206 args: args.args,
207 standard: args.standard,
208 run_hotkey: args.run_hotkey,
209 compatible_mode: args.compat,
210 remove_extensions: args.remove_extensions,
211 ascii_check: args.ascii_check,
212 add_to_path: add_to_path,

Callers 1

cli_handledFunction · 0.85

Calls 7

early_exitFunction · 0.85
nonsupport_checkFunction · 0.85
vscodeFunction · 0.85
compilerFunction · 0.85
workspaceFunction · 0.85
listFunction · 0.85
setupFunction · 0.70

Tested by

no test coverage detected