roblox-studio-utils 0.3.3

Cross-platform library for interacting with Roblox Studio
Documentation
use std::path::PathBuf;

use clap::Args;

use roblox_studio_utils::RobloxStudioOpener;

use crate::common::{CliResult, Context, ServerOptions};

#[derive(Debug, Args)]
pub struct ServerCommand {
    file_path: PathBuf,
    #[command(flatten)]
    server: ServerOptions,
}

impl ServerCommand {
    pub fn run(self, context: Context) -> CliResult {
        let endpoint = self.server.endpoint();
        self.server
            .apply(RobloxStudioOpener::new())
            .start_server(&self.file_path)?
            .run()?;

        let file_path = self.file_path.display();
        context.print(format!(
            "Launched Roblox Studio test server for {file_path} on {endpoint}."
        ));

        Ok(())
    }
}