proton_launch/
command.rs

1
2use crate::{paths::Paths, steam::SteamData};
3
4mod runnable;
5pub use runnable::*;
6
7pub mod backup;
8pub mod desktop_entry;
9pub mod info;
10pub mod install;
11pub mod move_compat;
12pub mod restore;
13pub mod run;
14pub mod uninstall;
15
16#[cfg_attr(feature = "commandline", derive(clap::Subcommand))]
17pub enum ProtonCommand {
18    /// Run a game with proton
19    Run(run::Run),
20
21    /// Create a compat folder for a game
22    MoveCompat(move_compat::MoveCompat),
23
24    /// Get newly added files in the compat folder
25    Backup(backup::Backup),
26
27    /// Restore files from a backup
28    Restore(restore::Restore),
29
30    /// Install a proton version, will do nothing if it's already installed
31    /// (or well that's what Steam seems to do)
32    Install(install::Install),
33
34    /// Uninstall a proton version, will do nothing if it's not installed
35    /// (or well that's what Steam seems to do)
36    Uninstall(uninstall::Uninstall),
37
38    /// Get info about a proton version, or all versions if no version is specified
39    Info(info::Info),
40
41    /// Create a desktop entry for a game
42    DesktopEntry(desktop_entry::MakeDE),
43}
44
45impl Runnable for ProtonCommand {
46    fn run(&self, paths: &Paths, steam_data: &SteamData) -> RunnableResult<()> {
47        match self {
48            ProtonCommand::Run(r) => r.run(paths, steam_data),
49            ProtonCommand::MoveCompat(m) => m.run(paths, steam_data),
50            ProtonCommand::Backup(b) => b.run(paths, steam_data),
51            ProtonCommand::Restore(r) => r.run(paths, steam_data),
52            ProtonCommand::Install(i) => i.run(paths, steam_data),
53            ProtonCommand::Uninstall(u) => u.run(paths, steam_data),
54            ProtonCommand::Info(i) => i.run(paths, steam_data),
55            ProtonCommand::DesktopEntry(d) => d.run(paths, steam_data),
56        }
57    }
58}