timetrack works locally

This commit is contained in:
Sebastian Moser
2026-10-11 22:20:46 +02:00
parent c19de1ed84
commit 759e6cad66
6 changed files with 52 additions and 18 deletions

View File

@@ -1,4 +1,5 @@
use clap::ArgMatches;
use marts::CliPart;
use core::result::Result::Err;
use core::unimplemented;
use mize::flume::bounded;
@@ -66,20 +67,22 @@ pub fn info(sub_matches: &ArgMatches, instance: &mut Mize) -> MizeResult<()> {
Err(mize_err!("not implemented"))
}
pub fn run(sub_matches: &ArgMatches, instance: &mut Mize) -> MizeResult<()> {
pub fn run(sub_matches: &ArgMatches, mize: &mut Mize) -> MizeResult<()> {
match sub_matches.subcommand() {
None => {
instance.wait();
None => { // run a mize instance (does whatever it's config will say)
mize.wait();
}
Some((runnable, sub_matches)) => {
let ext_args: Vec<String> = sub_matches
Some((runnable, sub_matches)) => { // run smth from a part. for now registered cli commands
let mut ext_args: Vec<String> = sub_matches
.get_many::<OsString>("")
.unwrap_or_default()
.map(|v| v.to_string_lossy().to_string())
.collect();
let mut ext_cmdline = vec![runnable.to_owned()];
ext_cmdline.append(&mut ext_args);
println!("runnable: {}", runnable);
println!("args: {:?}", ext_args);
let mut cli = mize.get_part_native::<CliPart>("cli")?;
cli.run(ext_cmdline)?;
}
}

View File

@@ -37,7 +37,10 @@ macro_rules! compile_in_parts {
$(
if enable_str.contains(&$name) {
tracing::info!("enabling compiled_in_part: {}", $name);
$part(&mut $mize);
if let Err(e) = $part(&mut $mize) {
print!("part '{}' failed with: ", $name);
e.log();
}
}
)+
};
@@ -66,6 +69,7 @@ fn tried_main() -> MizeResult<()> {
//"matrix": marts::part_matrix,
"ppc.server": marts::ppc::server::part_ppc_server,
"c2vi": marts::part_c2vi,
"sci.timetrack": marts::timetrack::part_timetrack,
};