MCPcopy Index your code
hub / github.com/endbasic/endbasic / app_main

Function app_main

cli/src/main.rs:70–107  ·  view source on GitHub ↗
(matches: Matches)

Source from the content-addressed store, hash-verified

68}
69
70fn app_main(matches: Matches) -> Result<i32> {
71 let mut console_spec = matches.opt_str("console");
72
73 let gpio_pins_spec = matches.opt_str("gpio-pins");
74
75 let service_url = matches
76 .opt_str("service-url")
77 .unwrap_or_else(|| endbasic_client::PROD_API_ADDRESS.to_owned());
78
79 let app_mode = AppMode::from_matches(matches)?;
80 if let AppMode::RunScript(path) = &app_mode {
81 let propline = extract_propline(path)?;
82 if console_spec.is_none() {
83 console_spec = propline.console_spec;
84 }
85 }
86
87 let (signals_tx, signals_rx) = async_channel::unbounded();
88 let (console_host, console_factory) =
89 setup_console(console_spec.as_deref(), signals_tx.clone())?;
90
91 let interpreter = thread::spawn(move || -> Result<i32> {
92 let runtime = tokio::runtime::Runtime::new()?;
93 runtime.block_on(async move {
94 async_app_main(
95 app_mode,
96 console_factory,
97 (signals_tx, signals_rx),
98 gpio_pins_spec,
99 service_url,
100 )
101 .await
102 })
103 });
104
105 console_host.run()?;
106 interpreter.join().expect("Interpreter thread shoult not have panicked")
107}
108
109app!("EndBASIC", app_build, app_main);

Callers

nothing calls this directly

Calls 4

extract_proplineFunction · 0.85
setup_consoleFunction · 0.85
async_app_mainFunction · 0.85
runMethod · 0.45

Tested by

no test coverage detected