From c1a536b96d6f1f6322c62ecb3b2c16a2129c6e38 Mon Sep 17 00:00:00 2001 From: Sebastian Moser Date: Mon, 1 Aug 2022 17:34:26 +0200 Subject: [PATCH] Commit so i can redownload it bcs I am changing the name of the repo to mize-server - also changed cargo package name to mize-server - Cargo.lock added bcs I ran it the first time - some (unfinished) cli argument logik added in src/main.rs and src/server.rs --- Cargo.toml | 2 +- src/main.rs | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bc6daca..2c11a8b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "mize" +name = "mize-server" version = "0.1.0" edition = "2021" diff --git a/src/main.rs b/src/main.rs index e7a11a9..980f612 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,61 @@ + +pub mod server; + +static HELP_MESSAGE: &str = "\ +Usage: + mize [options] [command] [options for command] + +Available Commands: + server starts the server + help prints this help message + version prints the version + +Available options + -h --help prints this help message + -v --version prints the version +"; + +//some flags e.g: "--file /tmp" can require that the next argument belongs to them instead of being +//the command +static FLAGS_WITH_ARGUMENTS: [&str: 0] = []; + +static AVAILABLE_COMMANDS: [&str: 1] = [server]; + +static VERSION_MESSAGE: &str = "\ +Version: 0 +"; + + fn main() { - println!("Hello, world!"); + /* + * WHAT IT DOES + * - get the arguments passed to the programm + * + * - sort out the flags for the main programm and the args for the comand + * - in "mize -h -u --lol server --file=/tmp --folder /home" the flags for the main programm would be ["-h","-u","--lol"] + * - and the args for the command would be ["server", "--file=/tmp --folder /home"] + * + * - get the command to "run" + * - in "mize -h -u --lol server --file=/tmp" it would be "server" + * + * - "run" the command and pass the options and subcommands to it + * + */ + + //### get the arguments passed to the programm + let args: Vec = std::env::args().collect(); + + //### sort out the flags for the main program and the args for the command + let main_flags:Vec = [].to_vec(); + + for arg in &args[1..] { + //if arg + println!("{}", arg.chars().next().unwrap()) + } + + //#### get the command to "run" + + //#### "run" the command and pass the options and subcommands to it + } +