Skip to content

Commit b48132a

Browse files
committed
Update flow
1 parent 7350c94 commit b48132a

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

src/args.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub fn get() -> Args {
55
}
66

77
#[derive(Parser, Debug, Clone)]
8-
#[command(version, about, long_about = None, after_help = "Will run for all apps, unless id is specified")]
8+
#[command(version, about, long_about = None, after_help = "Will run for all owned apps, unless id is specified")]
99
pub struct Args {
1010
/// App ID
1111
#[arg(short, long)]
@@ -15,6 +15,10 @@ pub struct Args {
1515
#[arg(short, long)]
1616
pub clear: bool,
1717

18+
/// All owned apps
19+
#[arg(short, long)]
20+
pub owned: bool,
21+
1822
/// All known apps
1923
#[arg(short, long)]
2024
pub all: bool,

src/helpers.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::contracts::{App, GetAppList};
22
use std::collections::HashMap;
33
use std::env;
44
use std::path::Path;
5-
use std::process;
65
use tokio::fs;
76
use xmltree::Element;
87

@@ -87,7 +86,7 @@ fn setting_failure() -> ! {
8786
eprintln!("Error: {}", error_msg);
8887
let mut _input = String::new();
8988
let _ = std::io::stdin().read_line(&mut _input);
90-
process::exit(1);
89+
std::process::exit(1);
9190
}
9291

9392
fn parse_xml_to_dictionary(xml: &str) -> Vec<App> {

src/main.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ use steam::run;
1111
async fn main() {
1212
let args = args::get();
1313

14-
if !args.worker {
15-
println!("Make sure Steam is running and logged in");
16-
println!("Otherwise the following will all fail");
17-
}
18-
1914
match args.id {
2015
Some(id) => {
2116
let name = match args.name {
@@ -32,8 +27,16 @@ async fn main() {
3227
None => {
3328
let apps_library = if args.all {
3429
get_app_list_all_vec().await
35-
} else {
30+
} else if args.owned {
3631
get_app_list_library().await
32+
} else {
33+
if !args.worker {
34+
println!(
35+
"To see all the options, run with --help\n\
36+
Make sure Steam is running and logged in"
37+
);
38+
}
39+
std::process::exit(1);
3740
};
3841

3942
let exe = std::env::current_exe().expect("Cannot get current executable name");

0 commit comments

Comments
 (0)