Add config module

This commit is contained in:
2026-03-19 01:07:38 +08:00
parent 6ff134b39d
commit 8ada36e962

39
src/config.rs Normal file
View File

@@ -0,0 +1,39 @@
//! Configuration module
//!
//! Command line arguments and runtime configuration
use anyhow::Result;
use clap::Parser;
use std::path::PathBuf;
#[derive(Parser, Debug)]
#[command(name = "momentry")]
#[command(about = "MoMentry Playground - Unified media player with overlays")]
pub struct Config {
#[arg(short = 'v', long = "video", help = "Video file path")]
pub video: Option<PathBuf>,
#[arg(short = 'a', long = "asr", help = "ASR JSON file path")]
pub asr: Option<PathBuf>,
#[arg(short = 'y', long = "yolo", help = "YOLO JSON file path")]
pub yolo: Option<PathBuf>,
#[arg(short = 'w', long = "width", default_value = "1280", help = "Window width")]
pub width: u32,
#[arg(short = 'h', long = "height", default_value = "720", help = "Window height")]
pub height: u32,
#[arg(long = "fullscreen", help = "Start in fullscreen mode")]
pub fullscreen: bool,
#[arg(long = "locale", default_value = "en", help = "UI language (en, zh-TW, etc.)")]
pub locale: String,
}
impl Config {
pub fn load() -> Result<Self> {
Ok(Config::parse())
}
}