Skip to content

Commit ea5563a

Browse files
committed
Allow multiple ids
1 parent 7ad056e commit ea5563a

File tree

3 files changed

+27
-16
lines changed

3 files changed

+27
-16
lines changed

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Source
4343
4444
| Option | Description |
4545
|-------------------------------|------------------------------------------------------------------|
46-
| `-i`, `--id <ID>` | App ID (required) |
46+
| `-i`, `--id <ID>` | App ID(s) - can specify multiple (required) |
4747
| `-c`, `--clear` | Clear achievements |
4848
| `-p`, `--parallel <PARALLEL>` | How many apps to process at once, too high will cause issues [1] |
4949
| `-h`, `--help` | Print help |
@@ -52,4 +52,16 @@ Source
5252

5353
You can combine arguments, for example `--id 123 --clear`
5454

55+
### Multiple IDs
56+
57+
You can pass multiple App IDs in two ways:
58+
59+
```bash
60+
# Comma-separated
61+
sau --id 123,456,789
62+
63+
# Multiple --id flags
64+
sau --id 123 --id 456 --id 789
65+
```
66+
5567
To find an App ID, search for the game on [SteamDB](https://steamdb.info/) or check the game's Steam store page URL.

src/args.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ pub fn get() -> Args {
77
#[derive(Parser, Debug, Clone)]
88
#[command(version, about, long_about = None, after_help = "You can combine arguments, for example --id 123 --clear")]
99
pub struct Args {
10-
/// App ID
11-
#[arg(short, long)]
12-
pub id: Option<u32>,
10+
/// Application ID(s). You can specify multiple IDs by using the flag multiple times or by separating IDs with commas in a single flag.
11+
#[arg(short, long, value_delimiter = ',')]
12+
pub id: Vec<u32>,
1313

1414
/// Clear achievements
1515
#[arg(short, long)]

src/main.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,17 @@ use steam::run;
77
async fn main() {
88
let args = args::get();
99

10-
match args.id {
11-
Some(id) => {
12-
run(id, args.clear);
13-
}
14-
None => {
15-
if !args.worker {
16-
println!(
17-
"To see all the options, run with --help\n\
18-
Make sure Steam is running and logged in"
19-
);
20-
}
21-
std::process::exit(0);
10+
if args.id.is_empty() {
11+
if !args.worker {
12+
println!(
13+
"To see all the options, run with --help\n\
14+
Make sure Steam is running and logged in"
15+
);
2216
}
17+
std::process::exit(0);
18+
}
19+
20+
for id in args.id {
21+
run(id, args.clear);
2322
}
2423
}

0 commit comments

Comments
 (0)