Initial commit: battlenet-manager tray daemon and CLI
This commit is contained in:
+66
@@ -0,0 +1,66 @@
|
||||
mod config;
|
||||
mod diagnose;
|
||||
mod launcher;
|
||||
mod proton;
|
||||
mod tray;
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
/// Battle.net launcher manager for Linux via umu/Proton-GE.
|
||||
///
|
||||
/// Running without a subcommand starts the system tray daemon.
|
||||
/// Use `launch` in your .desktop shortcut for a direct, no-UI launch.
|
||||
#[derive(Parser)]
|
||||
#[command(name = "battlenet-manager", version, about)]
|
||||
struct Cli {
|
||||
#[command(subcommand)]
|
||||
command: Option<Commands>,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum Commands {
|
||||
/// Start the system tray daemon (default when no subcommand given)
|
||||
Tray,
|
||||
|
||||
/// Launch Battle.net immediately and return — use this in .desktop shortcuts
|
||||
Launch,
|
||||
|
||||
/// Gracefully kill all Battle.net / Wine processes
|
||||
Kill,
|
||||
|
||||
/// Check setup health and report any problems
|
||||
Diagnose,
|
||||
|
||||
/// Download and switch GE-Proton versions
|
||||
UpdateProton {
|
||||
/// Install the latest release automatically
|
||||
#[arg(long)]
|
||||
latest: bool,
|
||||
|
||||
/// Install a specific version (e.g. GE-Proton9-20)
|
||||
#[arg(long, value_name = "VERSION")]
|
||||
version: Option<String>,
|
||||
|
||||
/// List recent releases and exit
|
||||
#[arg(long)]
|
||||
list: bool,
|
||||
},
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let cli = Cli::parse();
|
||||
let config = config::Config::load()?;
|
||||
|
||||
match cli.command.unwrap_or(Commands::Tray) {
|
||||
Commands::Tray => tray::run(&config)?,
|
||||
Commands::Launch => launcher::launch(&config)?,
|
||||
Commands::Kill => launcher::kill()?,
|
||||
Commands::Diagnose => diagnose::run(&config),
|
||||
Commands::UpdateProton { latest, version, list } => {
|
||||
proton::run(&config, latest, version, list)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user