-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcli_opts.rs
47 lines (38 loc) · 1.02 KB
/
cli_opts.rs
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
use clap::Parser;
#[derive(Parser)]
pub struct Opts {
#[clap(subcommand)]
pub subcommand: SubCommand,
}
#[derive(Parser)]
pub enum SubCommand {
/// Run a dev server to host a given Stateroom module.
Serve(ServeCommand),
Build,
Dev {
#[clap(default_value = "8080")]
port: u16,
},
}
#[derive(Parser)]
pub struct LoginCommand {
#[clap(short, long)]
pub token: Option<String>,
#[clap(short, long)]
pub clear: bool,
}
#[derive(Parser)]
pub struct ServeCommand {
/// The module (.wasm file) to serve.
pub module: String,
/// The port to serve on.
#[clap(short, long, default_value = "8080")]
pub port: u16,
/// The time interval (in seconds) between WebSocket heartbeat pings.
#[clap(short = 'i', long, default_value = "30")]
pub heartbeat_interval: u64,
/// The duration of time without hearing from a client before it is
/// assumed to be disconnected.
#[clap(short = 't', long, default_value = "120")]
pub heartbeat_timeout: u64,
}