From bc406f4ddb65c48cd8362feab54f8e12258c92c5 Mon Sep 17 00:00:00 2001 From: Cecilia Sanare Date: Sat, 2 Mar 2024 19:56:54 -0600 Subject: [PATCH] feat: added support for modifying one game - added todo list to readme --- README.md | 14 +++++++++++++- src/commands/default.rs | 24 +++++++++++++++--------- src/main.rs | 2 +- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 4fb4568..b3b6617 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,18 @@ ### Usage ```sh -# One time run, checks all steam games and validates them +# Applies tweaks to all apps protontweaks +# Applies tweaks to one app +protontweaks ``` + +### TODO + +- **Convenience** + - Add the ability to install a watch service that will detect games being installed to steam +- **Performance** + - Apply tweaks async so multiple games can be tweaked at once + - Tweak DB Caching +- **Tweak DB** + - Split into its own repository diff --git a/src/commands/default.rs b/src/commands/default.rs index 830a01b..dd84e34 100644 --- a/src/commands/default.rs +++ b/src/commands/default.rs @@ -5,10 +5,20 @@ use crate::{ utils::protontricks, }; -pub fn command() -> Result<(), String> { +pub fn command(app_id: Option) -> Result<(), String> { println!("Automatically applying necessary tweaks..."); - let apps = protontricks::list::apps()?; + let apps = if let Some(app_id) = app_id { + vec![app_id] + } else { + let apps = protontricks::list::apps()?; + println!( + "Discovered {} from steam...", + format!("{} apps", apps.len()).bold() + ); + apps + }; + let tweaked_apps = apps .iter() .map(|app_id| tweaks::get(&app_id)) @@ -16,11 +26,6 @@ pub fn command() -> Result<(), String> { .map(|app| app.unwrap()) .collect::>(); - println!( - "Discovered {} from steam...", - format!("{} apps", tweaked_apps.len()).bold() - ); - let (mut tweaks_applied, mut total_tweaks) = (0, 0); for app in tweaked_apps { @@ -31,8 +36,9 @@ pub fn command() -> Result<(), String> { if tweaks_applied == 0 { println!( - "No tweaks were necessary! {}", - format!("({total_tweaks} tweaks attempted)").bold() + "{} {}", + "No tweaks were necessary!".green().bold(), + format!("({total_tweaks} tweaks attempted)").italic() ); } else { println!( diff --git a/src/main.rs b/src/main.rs index 17ac7b3..53efb6d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -76,7 +76,7 @@ fn main() { let args = Cli::parse(); let result = match args.command { - _ => commands::default::command(), + _ => commands::default::command(args.app_id), }; if result.is_err() {