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

17
Cargo.toml Normal file
View file

@ -0,0 +1,17 @@
[package]
name = "moddah"
version = "0.1.0"
authors = ["Jonas_Jones"]
edition = "2021"
description = "A cli tool that allows for easy client and server installation of QuitlMC, FabricMC and ForgeModLoader for Minecraft"
#documentation = "https://doc.jonasjones.me/moddah/"
readme = "README.md"
homepage = "https://jonasjones.me/moddah"
repository = "https://github.com/J-onasJones/moddah"
license = "MIT OR Apache-2.0"
keywords = ["fabric", "quilt", "forge", "mineraft", "modded", "modding"]
categories = ["accessibility", "command-line-utilities", "development-tools"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

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());
}
},
}
}
}