feat(desktop): add per-instance desktop shortcut toggle

This commit is contained in:
objz committed 2026-04-05 15:12:48 +02:00
1 parent 3047086fa2
commit e18b18c0be
9 files changed
+172 -5

No files matched your search

+13
View File
@@ -17,6 +17,7 @@ pub async fn handle_instance(matches: &ArgMatches) -> CliResult {
Some(("rename", sub_matches)) => rename_instance(sub_matches),
Some(("launch", sub_matches)) => launch_instance(sub_matches).await,
Some(("config", sub_matches)) => config_instance(sub_matches),
Some(("desktop", sub_matches)) => desktop_instance(sub_matches),
_ => Ok(()),
}
}
@@ -153,6 +154,18 @@ async fn launch_instance(matches: &ArgMatches) -> CliResult {
Ok(())
}
fn desktop_instance(matches: &ArgMatches) -> CliResult {
let name = required_arg(matches, "name")?;
let config = manager().load_one(name)?;
let enabled = crate::instance::desktop::toggle(&config)?;
if enabled {
println!("Desktop shortcut created for '{}'.", name);
} else {
println!("Desktop shortcut removed for '{}'.", name);
}
Ok(())
}
fn config_instance(matches: &ArgMatches) -> CliResult {
let name = required_arg(matches, "name")?;
let manager = manager();
+6
View File
@@ -98,6 +98,12 @@ fn build_command() -> Command {
.arg_required_else_help(true)
.arg(Arg::new("name").required(true).action(ArgAction::Set))
.arg(Arg::new("set").long("set").action(ArgAction::Set)),
)
.subcommand(
Command::new("desktop")
.about("Toggle desktop shortcut for an instance")
.arg_required_else_help(true)
.arg(Arg::new("name").required(true).action(ArgAction::Set)),
),
)
.subcommand(build_content_command("mod", "mods"))