1
use clap::Subcommand;
2

            
3
use crate::config::Config;
4

            
5
pub mod info;
6
pub mod list;
7
pub mod run;
8
pub mod setup;
9
pub mod uninstall;
10
pub mod watch;
11

            
12
#[derive(Debug, Subcommand)]
13
pub enum Command {
14
    /// Lists the apps installed on Steam
15
    List,
16
    /// Register or Unregister the watch service
17
    Setup,
18
    /// [experimental]: Runs the steam launch command and applies any necessary tweaks
19
    Run(run::CommandArgs),
20
    /// [experimental]: Watches for any steam apps to be installed and automatically adds 'protontweaks' to the launch options
21
    Watch,
22
    /// Uninstalls the protontweaks service and deletes any configs
23
    Uninstall,
24
    /// Outputs information about the system
25
    Info,
26
}
27

            
28
pub async fn handle(command: Command) -> Result<(), String> {
29
    let config = Config::discover();
30

            
31
    match command {
32
        Command::List => list::command().await,
33
        Command::Setup => setup::command().await,
34
        Command::Run(args) => run::command(config, args).await,
35
        Command::Watch => watch::command().await,
36
        Command::Uninstall => uninstall::command().await,
37
        Command::Info => info::command().await,
38
    }
39
}