Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new files with their impls and a basic test that checks few thi… #82

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
230 changes: 230 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
clap = { version = "4.5.20", features = ["derive"] }
31 changes: 31 additions & 0 deletions src/args.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use clap::{Parser, Subcommand};

#[derive(Debug, Parser)]
#[clap(
name = "MCServer",
about = "MCServer a cli utility created to host a Fully Customizable Minecraft Server",
author = "LordOfWizard",
version = "0.0.1"
)]
pub struct MCServer {
#[clap(subcommand)]
pub command: Commands,
}

#[derive(Debug, Subcommand)]
pub enum Commands {
/// Generates a new Minecraft Server instance.
Setup,
/// Builds a new Minecraft Server Instance.
Build,
/// Starts the Minecraft Server.
Start,
/// Stops the Minecraft Server.
Stop,
/// Prints the logs of the latest run.
Log,
/// Gives debug information on Currently running server.
Check,
/// Prints the connectable url of the Minecraft Server.
GetUrl,
}
3 changes: 3 additions & 0 deletions src/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn build() {
// TODO Build this
}
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
mod run;
mod args;
mod start;
mod build;
mod setup;
use run::Run;
fn main() {
println!("Hello, world!");
Expand Down
24 changes: 23 additions & 1 deletion src/run.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
pub struct Run;
use clap::Parser;
use crate::args::{MCServer,Commands};
use crate::build::build;
use crate::setup::setup;
use crate::start::start_server;


impl Run {
pub fn new() {
// TODO this is where the program should start
println!("Program Started");

let server_instance = MCServer::parse();

match server_instance.command {
Commands::Setup => setup(),
Commands::Build => build(),
Commands::Start => start_server(),

_ => println!("Nah didn't reach me bruh"),
}

}
}

Expand All @@ -13,7 +30,12 @@ mod tests {

#[test]
fn run_has_std_practices() {
Run::new();
//Run::new();
assert!(true);
}
#[test]
fn setup_available() {
setup();
assert!(true);
}
}
3 changes: 3 additions & 0 deletions src/setup.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn setup(){
// TODO Build this
}
3 changes: 3 additions & 0 deletions src/start.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn start_server(){
// TODO Build this
}
Loading