added rust files

This commit is contained in:
Jonas_Jones 2022-09-19 16:37:05 +02:00
parent 4b1ca233a5
commit 90373f7b29
3 changed files with 82 additions and 0 deletions

43
src/cliargs/mod.rs Normal file
View file

@ -0,0 +1,43 @@
pub(crate) fn help()
{{
println!("Moddah is a managing tool for Minecraft modded clients and servers.
The supported toolchains are FabricMC, ForgeModLoader, QuiltMC.
Usage:
moddah
moddah <operation> [...]
Operations:
moddah {{-h --help}} print this help message
moddah {{-v --version}} print the version of Moddah
moddah {{-l --list}} [...] list versions
moddah {{-i --install}} [...] install a Modloader
Options:
moddah {{-l --list}} [...]
- minecraft list all minecraft versions
- fabric list all minecraft versions supported by the FabricMC toolchain
- forge list all minecraft versions supported by the ForgeModLoader toolchain
- quilt list all minecraft versions supported by the QuiltMC toolchain
moddah {{-i --install}} [modloader] [minecraft-version] [environment] [loader-version] [directory]
[modloader]:
- fabric
- forge
- quilt
[minecraft-version]:
- [any version that is supported by the modloader of choice]
[environment]:
- client
- server
[loader-version]:
- [any version of the loader of choice]
[directory]:
- [leave blank for current directory]
- [directory of choice]
")
}}

22
src/main.rs Normal file
View file

@ -0,0 +1,22 @@
use std::env;
mod cliargs;
fn main() {
let args: Vec<String> = env::args().collect();
for i in args.iter()
{
match i.as_str()
{
"--help" => cliargs::help(),
_ => {
if !args.iter().position(|r| r.as_str() == i).unwrap().parse() == 0
{
println!("Error")
} else {
println!("{}", args.iter().position(|r| r.as_str() == i).unwrap());
}
},
}
}
}