moved arg matcher funtion.

This commit is contained in:
michael-bailey 2022-09-06 18:00:36 +01:00
parent 2eaa05f1be
commit 31d67889ff
4 changed files with 17 additions and 22 deletions

View File

@ -1,9 +1,10 @@
use std::fs::OpenOptions; use crate::{
bootstrapper::bootstrapper::Bootstrapper, config_manager::get_args,
};
use actix::{Actor, Addr}; use actix::{Actor, Addr};
use clap::ArgMatches; use clap::ArgMatches;
use std::fs::OpenOptions;
use tokio::fs::File; use tokio::fs::File;
use crate::bootstrapper::bootstrapper::Bootstrapper;
use super::get_args;
pub struct Builder { pub struct Builder {
pub(super) args: ArgMatches, pub(super) args: ArgMatches,
@ -11,9 +12,7 @@ pub struct Builder {
impl Builder { impl Builder {
pub(super) fn new() -> Self { pub(super) fn new() -> Self {
Self { Self { args: get_args() }
args: get_args(),
}
} }
pub fn file(mut self, path: String) -> Self { pub fn file(mut self, path: String) -> Self {
@ -22,7 +21,8 @@ impl Builder {
.write(true) .write(true)
.read(true) .read(true)
.open(path) .open(path)
.ok().map(|val| File::from(val)); .ok()
.map(|val| File::from(val));
self self
} }

View File

@ -1,7 +1,5 @@
mod bootstrapper; mod bootstrapper;
mod builder; mod builder;
mod messages; mod messages;
mod arg_fetcher;
pub(crate) use arg_fetcher::get_args;
pub(crate) use bootstrapper::Bootstrapper; pub(crate) use bootstrapper::Bootstrapper;

View File

@ -3,28 +3,25 @@
//! It starts the actor runtime and then sleeps //! It starts the actor runtime and then sleeps
//! for the duration of the program. //! for the duration of the program.
pub(crate) mod server; pub(crate) mod bootstrapper;
pub(crate) mod client_management; pub(crate) mod client_management;
pub(crate) mod config_manager;
pub(crate) mod lua;
pub(crate) mod network; pub(crate) mod network;
pub(crate) mod prelude; pub(crate) mod prelude;
pub(crate) mod rhai; pub(crate) mod rhai;
pub(crate) mod lua;
pub(crate) mod scripting; pub(crate) mod scripting;
pub(crate) mod bootstrapper; pub(crate) mod server;
pub(crate) mod config_manager;
use crate::bootstrapper::Bootstrapper;
use std::env::args;
use actix::Actor;
use server::Server; use server::Server;
use tokio::time::{sleep, Duration}; use tokio::time::{sleep, Duration};
use clap::{App, Arg, value_parser};
use openssl::version::version;
use crate::bootstrapper::{Bootstrapper, get_args};
#[actix::main()] #[actix::main()]
async fn main() { async fn main() {
let init = Bootstrapper::create() let init = Bootstrapper::create().build();
.build();
loop { loop {
sleep(Duration::from_millis(1000)).await; sleep(Duration::from_millis(1000)).await;
} }