the mize bin works
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
use clap::ArgMatches;
|
||||
use core::result::Result::Err;
|
||||
use core::unimplemented;
|
||||
use flume::bounded;
|
||||
use home::home_dir;
|
||||
use mize::flume::bounded;
|
||||
use mize::mize_err;
|
||||
use std::ffi::OsString;
|
||||
use std::io::Read;
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
use tracing::debug;
|
||||
use mize::ciborium;
|
||||
|
||||
use mize::error::{IntoMizeResult, MizeError, MizeResult, MizeResultTrait};
|
||||
use mize::instance::subscription::Subscription;
|
||||
@@ -43,6 +43,7 @@ pub fn get(sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
}
|
||||
|
||||
pub fn call(sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
println!("call cmd not implemented");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -57,16 +58,17 @@ pub fn create(sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
pub fn is_running(sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
pub fn status(sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
println!("not implemented");
|
||||
Err(mize_err!("not implemented"))
|
||||
}
|
||||
|
||||
pub fn mount(sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
Ok(())
|
||||
pub fn info(sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
println!("not implemented");
|
||||
Err(mize_err!("not implemented"))
|
||||
}
|
||||
|
||||
pub fn daemon(sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
pub fn run(sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
let instance = Mize::with_config(config_from_cli_args(sub_matches)?)?;
|
||||
|
||||
instance.wait();
|
||||
@@ -91,38 +93,25 @@ pub fn set(sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
}
|
||||
|
||||
pub fn show(sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
let instance = Mize::with_config(config_from_cli_args(sub_matches)?)?;
|
||||
println!("not implemented");
|
||||
// let instance = Mize::with_config(config_from_cli_args(sub_matches)?)?;
|
||||
|
||||
let id = sub_matches
|
||||
.get_one::<String>("id")
|
||||
.ok_or(MizeError::new().msg("No id Argument specified"))?;
|
||||
// let id = sub_matches
|
||||
// .get_one::<String>("id")
|
||||
// .ok_or(MizeError::new().msg("No id Argument specified"))?;
|
||||
|
||||
let item = instance.get(id)?;
|
||||
// let item = instance.get(id)?;
|
||||
|
||||
let (tx, rx) = bounded::<Update>(4);
|
||||
let sub = Subscription::from_sender(tx);
|
||||
instance.sub(id, sub)?;
|
||||
// let (tx, rx) = bounded::<Update>(4);
|
||||
// let sub = Subscription::from_sender(tx);
|
||||
// instance.sub(id, sub)?;
|
||||
|
||||
println!("item: {}", item.as_data_full()?);
|
||||
// println!("item: {}", item.as_data_full()?);
|
||||
|
||||
for update in rx {
|
||||
println!("####### GOT UPDATE #######");
|
||||
println!("item: {}", update.new_item()?.as_data_full()?);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn stop(sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn gui(sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
let mut instance = Mize::with_config(config_from_cli_args(sub_matches)?)?;
|
||||
|
||||
instance.load_part("mme")?;
|
||||
|
||||
instance.wait();
|
||||
// for update in rx {
|
||||
// println!("####### GOT UPDATE #######");
|
||||
// println!("item: {}", update.new_item()?.as_data_full()?);
|
||||
// }
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -141,7 +130,7 @@ pub fn format_cbor(sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn run_from_module(cmd: &str, sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
pub fn run_from_part(cmd: &str, sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
let default = OsString::default();
|
||||
let mut sub_cmd_line: Vec<OsString> = sub_matches
|
||||
.get_many::<OsString>("")
|
||||
|
||||
Reference in New Issue
Block a user