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

Function run

src-tauri/src/cli/mod.rs:72–113  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

70}
71
72pub fn run() {
73 let no_args = std::env::args().len() <= 1;
74
75 let args = match args::parse() {
76 Ok(args) => args,
77 Err(e) => {
78 if no_args {
79 native_dialog::MessageDialog::new()
80 .set_title("早期错误")
81 .set_text(&format!("{:?}", e))
82 .show_alert()
83 .unwrap();
84 } else {
85 println!("[\x1b[31mERROR\x1b[0m] 早期错误:{:?}", e);
86 #[cfg(windows)]
87 {
88 out!("按任意键退出...");
89 winapi::getch();
90 }
91 }
92 std::process::exit(1)
93 }
94 };
95
96 if no_args {
97 #[cfg(windows)]
98 if !has_webview2_installed() {
99 warn!("WebView 2 未安装。退化到命令行界面。");
100 out!("检测到您的计算机上尚未安装 WebView 2;将使用命令行界面替代。建议您前往 https://go.microsoft.com/fwlink/p/?LinkId=2124703 下载 WebView 2 以获得更好体验。");
101 cli_handled(args);
102 return;
103 }
104 gui_handled();
105 return;
106 }
107
108 if args.gui {
109 gui_handled()
110 } else {
111 cli_handled(args)
112 }
113}
114
115fn cli_handled(args: CliArgs) {
116 match cli(args) {

Callers 1

mainFunction · 0.85

Calls 5

parseFunction · 0.85
getchFunction · 0.85
has_webview2_installedFunction · 0.85
cli_handledFunction · 0.85
gui_handledFunction · 0.85

Tested by

no test coverage detected