Skip to content

Commit

Permalink
make it better now
Browse files Browse the repository at this point in the history
  • Loading branch information
MagicTeaMC committed Aug 26, 2024
1 parent daa680e commit eaaa649
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ Give information to us with terminal (Don't be afraid, it's very easy):

If you want it to setup automantic, here is a command (If you are using Windows, please add .exe after the file name, like `./Minecraft-server-auto-setup.exe`):
```
./Minecraft-server-auto-setup --software=Paper --version=1.21.1 --eula=true
./Minecraft-server-auto-setup --software=paper --mc-version=1.21.1 --eula=true -y
```
14 changes: 7 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ fn inquired<T>(binding: Result<T, inquire::InquireError>) -> T {
impl Software {
fn from_name(name: String) -> Self {
match name.as_str() {
"Paper" => Self::Paper,
"Folia" => Self::Folia,
"Purpur" => Self::Purpur,
"paper" => Self::Paper,
"folia" => Self::Folia,
"purpur" => Self::Purpur,
_ => panic!("Invalid software name: {}", name),
}
}

fn name(&self) -> String {
match self {
Self::Paper => "Paper",
Self::Folia => "Folia",
Self::Purpur => "Purpur",
Self::Paper => "paper",
Self::Folia => "folia",
Self::Purpur => "purpur",
}
.to_string()
}
Expand Down Expand Up @@ -94,7 +94,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
)
.prompt();

Software::from_name(inquired(binding).to_string())
Software::from_name(inquired(binding).to_lowercase().to_string())
} else {
cli.software.unwrap()
}
Expand Down
4 changes: 2 additions & 2 deletions src/softwares.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn get_other(software: String, version: String) -> Result<(), Box<dyn std::e
let res = client
.get(format!(
"https://api.papermc.io/v2/projects/{}/versions/{}/builds",
software.to_lowercase(), version
software, version
))
.send();

Expand Down Expand Up @@ -66,7 +66,7 @@ pub fn get_other(software: String, version: String) -> Result<(), Box<dyn std::e

pub fn get(name: String, version: String) -> Result<(), Box<dyn std::error::Error>> {
match name.as_str() {
"Purpur" => get_purpur(version),
"purpur" => get_purpur(version),
_ => get_other(name, version),
}
}

0 comments on commit eaaa649

Please sign in to comment.