MCPcopy Index your code
hub / github.com/FrameworkComputer/framework-system / run_with_args

Function run_with_args

framework_lib/src/commandline/mod.rs:1312–1935  ·  view source on GitHub ↗
(args: &Cli, _allupdate: bool)

Source from the content-addressed store, hash-verified

1310}
1311
1312pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
1313 #[cfg(feature = "uefi")]
1314 {
1315 log::set_max_level(args.verbosity.0);
1316 }
1317 #[cfg(not(feature = "uefi"))]
1318 {
1319 // TOOD: Should probably have a custom env variable?
1320 // let env = Env::default()
1321 // .filter("FRAMEWORK_COMPUTER_LOG")
1322 // .write_style("FRAMEWORK_COMPUTER_LOG_STYLE");
1323
1324 let level = args.verbosity.0.as_str();
1325 env_logger::Builder::from_env(env_logger::Env::default().default_filter_or(level))
1326 .format_target(false)
1327 .format_timestamp(None)
1328 .init();
1329 }
1330
1331 // Must be run before any application code to set the config
1332 if let (Some(pd_addrs), Some(pd_ports)) = (args.pd_addrs, args.pd_ports) {
1333 let platform = Platform::GenericFramework(pd_addrs, pd_ports);
1334 Config::set(platform);
1335 }
1336
1337 let ec = if let Some(driver) = args.driver {
1338 if let Some(driver) = CrosEc::with(driver) {
1339 driver
1340 } else {
1341 println!("Selected driver {:?} not available.", driver);
1342 return 1;
1343 }
1344 } else {
1345 CrosEc::new()
1346 };
1347
1348 #[cfg(feature = "uefi")]
1349 if args.paginate {
1350 enable_page_break();
1351 }
1352
1353 if args.help {
1354 // Only print with uefi feature here because without clap will already
1355 // have printed the help by itself.
1356 #[cfg(feature = "uefi")]
1357 print_help(_allupdate);
1358 return 2;
1359 } else if args.versions {
1360 print_versions(&ec);
1361 } else if args.version {
1362 print_tool_version();
1363 } else if args.features {
1364 print_err(ec.get_features());
1365 } else if args.esrt {
1366 print_esrt();
1367 } else if let Some(compare_version_ver) = &args.compare_version {
1368 let compare_ret = compare_version(args.device, compare_version_ver.to_string(), &ec);
1369 println!("Comparison Result: {}", compare_ret);

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls 15

enable_page_breakFunction · 0.85
print_helpFunction · 0.85
print_versionsFunction · 0.85
print_tool_versionFunction · 0.85
print_errFunction · 0.85
compare_versionFunction · 0.85
get_platformFunction · 0.85
sleepFunction · 0.85
print_nvidia_infoFunction · 0.85
handle_charge_limitFunction · 0.85
handle_fp_led_levelFunction · 0.85
handle_fp_brightnessFunction · 0.85

Tested by

no test coverage detected