Skip to content

Commit

Permalink
feat: added support for modifying one game
Browse files Browse the repository at this point in the history
- added todo list to readme
  • Loading branch information
cecilia-sanare committed Mar 3, 2024
1 parent f4b00ac commit bc406f4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <app-id>
```

### 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
24 changes: 15 additions & 9 deletions src/commands/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,27 @@ use crate::{
utils::protontricks,
};

pub fn command() -> Result<(), String> {
pub fn command(app_id: Option<String>) -> 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))
.filter(|app| app.is_some())
.map(|app| app.unwrap())
.collect::<Vec<App>>();

println!(
"Discovered {} from steam...",
format!("{} apps", tweaked_apps.len()).bold()
);

let (mut tweaks_applied, mut total_tweaks) = (0, 0);

for app in tweaked_apps {
Expand All @@ -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!(
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit bc406f4

Please sign in to comment.