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
This commit is contained in:
Sebastian Moser
2022-08-01 17:34:26 +02:00
parent 78e783163b
commit c1a536b96d
2 changed files with 60 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
[package]
name = "mize"
name = "mize-server"
version = "0.1.0"
edition = "2021"

View File

@@ -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<String> = std::env::args().collect();
//### sort out the flags for the main program and the args for the command
let main_flags:Vec<String> = [].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
}