MizeIds are now stored in a StringPool for Vec<String>
This commit is contained in:
@@ -12,7 +12,15 @@ use mize::instance::Instance;
|
||||
|
||||
pub fn run(sub_matches: &ArgMatches) -> MizeResult<()> {
|
||||
|
||||
let instance = Instance::new();
|
||||
// TODO NEXT!!!
|
||||
// - add --system arg
|
||||
// - add --user arg
|
||||
// - --config arg
|
||||
// - to set a location, where there will be a /store and a /sock
|
||||
// - listen for connections on that sock
|
||||
// - msg handeling
|
||||
let instance = Instance::with_config(todo!());
|
||||
|
||||
/*
|
||||
let instance_path = match sub_matches.get_one::<String>("store") {
|
||||
Some(a) => PathBuf::from(a),
|
||||
|
||||
@@ -260,10 +260,10 @@ fn level_from_env(var_name: &str, log_level: LevelFilter) -> (Option<log::LevelF
|
||||
|
||||
fn cli_matches() -> clap::ArgMatches {
|
||||
|
||||
let store_arg = Arg::new("store")
|
||||
.short('s')
|
||||
.long("store")
|
||||
.help("The folder used as the Itemstore");
|
||||
let folder_arg = Arg::new("folder")
|
||||
.short('f')
|
||||
.long("folder")
|
||||
.help("The folder the Instance stores all it's data and the socket for connections");
|
||||
|
||||
let main = Command::new(APPNAME)
|
||||
.version(crate_version!())
|
||||
@@ -284,6 +284,7 @@ fn cli_matches() -> clap::ArgMatches {
|
||||
.action(ArgAction::SetTrue)
|
||||
.help("set the log-level to OFF")
|
||||
)
|
||||
.arg(&folder_arg)
|
||||
.subcommand(
|
||||
Command::new("run")
|
||||
.aliases(["r"])
|
||||
@@ -295,30 +296,29 @@ fn cli_matches() -> clap::ArgMatches {
|
||||
.subcommand(
|
||||
Command::new("mount")
|
||||
.aliases(["m"])
|
||||
.arg(&store_arg)
|
||||
)
|
||||
.subcommand(
|
||||
Command::new("get")
|
||||
.aliases(["g"])
|
||||
.arg(&store_arg)
|
||||
.arg(&folder_arg)
|
||||
.arg(Arg::new("id").help("The id or path to get"))
|
||||
)
|
||||
.subcommand(
|
||||
Command::new("set")
|
||||
.aliases(["s"])
|
||||
.arg(&store_arg)
|
||||
.arg(&folder_arg)
|
||||
.arg(Arg::new("id").help("The id or path to set"))
|
||||
)
|
||||
.subcommand(
|
||||
Command::new("show")
|
||||
.aliases(["so"])
|
||||
.arg(&store_arg)
|
||||
.arg(&folder_arg)
|
||||
.arg(Arg::new("id").help("The id or path to sub to and show"))
|
||||
)
|
||||
.subcommand(
|
||||
Command::new("call")
|
||||
.aliases(["c"])
|
||||
.arg(&store_arg)
|
||||
.arg(&folder_arg)
|
||||
)
|
||||
.arg_required_else_help(true);
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ use crate::instance::Instance;
|
||||
use crate::error::{IntoMizeResult, MizeError, MizeResult};
|
||||
|
||||
|
||||
pub fn os_instance_init<S: Store>(instance: Instance<S>) -> MizeResult<()> {
|
||||
pub fn os_instance_init<S: Store>(instance: &mut Instance<S>) -> MizeResult<()> {
|
||||
// this is the code, that runs to initialize an Instance on a system with an os present.
|
||||
|
||||
// load MIZE_CONFIG_FILE as the instance, which is item 0
|
||||
////// load MIZE_CONFIG_FILE as the instance, which is item 0
|
||||
let config_file_path = std::env::var("MIZE_CONFIG_FILE")
|
||||
.mize_result_msg("Could not get the MIZE_CONFIG_FILE Environment Variable")?;
|
||||
|
||||
@@ -24,6 +24,9 @@ pub fn os_instance_init<S: Store>(instance: Instance<S>) -> MizeResult<()> {
|
||||
.mize_result_msg(format!("Could not deserialize the content of MIZE_CONFIG_FILE at {}", &config_file_path))?;
|
||||
|
||||
instance.set("0", config)?;
|
||||
|
||||
////// load config from MIZE_CONFIG env var
|
||||
//TODO
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user