1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
use std::path::PathBuf;
use clap::{Args, Parser, Subcommand};
#[derive(Args, Debug)]
pub struct ProfileSelectArgs {
/// The name of the profile to select.
#[arg(index = 1)]
pub profile: String
}
#[derive(Args, Debug)]
pub struct ProfileCreateArgs {
/// The name of the new profile.
#[arg(index = 1)]
pub name: String,
/// Clone profile information from an existing profile.
#[arg(long, short = 'c')]
pub clone: Option<String>,
/// The Minecraft version to be launched by this profile. Will use the latest release by default.
#[arg(long, short = 'v')]
pub version: Option<String>,
/// The instance in which this profile will launch the game. By default, will create a new instance
/// with the same name as this profile.
#[arg(long, short = 'i')]
pub instance: Option<String>
}
#[derive(Subcommand, Debug)]
pub enum ProfileCommand {
Select(ProfileSelectArgs),
Create(ProfileCreateArgs),
List
}
#[derive(Args, Debug)]
pub struct ProfileArgs {
#[command(subcommand)]
subcmd: Option<ProfileCommand>
}
impl ProfileArgs {
pub fn command(&self) -> &ProfileCommand {
self.subcmd.as_ref().unwrap_or(&ProfileCommand::List)
}
}
#[derive(Subcommand, Debug)]
pub enum RootCommand {
Profile(ProfileArgs),
Instance,
Launch
}
#[derive(Parser, Debug)]
#[clap(version)]
pub struct Cli {
/// Run the launcher in offline mode. The launcher will not attempt to make any requests using
/// the network. The launcher _will_ verify the integrity of files required to launch the game,
/// and refuse to launch the game with an error if it must download a file.
#[arg(long, global = true)]
pub offline: bool,
/// Directory which the launcher will perform its work in. Defaults to an application-specific
/// directory based on your OS.
#[arg(long, global = true, value_hint = clap::ValueHint::DirPath)]
pub home: Option<PathBuf>,
#[command(subcommand)]
pub subcmd: RootCommand
}
|