stateroom_cli/
cli_opts.rs

1use clap::Parser;
2
3#[derive(Parser)]
4pub struct Opts {
5    #[clap(subcommand)]
6    pub subcommand: SubCommand,
7}
8
9#[derive(Parser)]
10pub enum SubCommand {
11    /// Run a dev server to host a given Stateroom module.
12    Serve(ServeCommand),
13
14    Build,
15    Dev {
16        #[clap(default_value = "8080")]
17        port: u16,
18    },
19}
20
21#[derive(Parser)]
22pub struct LoginCommand {
23    #[clap(short, long)]
24    pub token: Option<String>,
25
26    #[clap(short, long)]
27    pub clear: bool,
28}
29
30#[derive(Parser)]
31pub struct ServeCommand {
32    /// The module (.wasm file) to serve.
33    pub module: String,
34
35    /// The port to serve on.
36    #[clap(short, long, default_value = "8080")]
37    pub port: u16,
38
39    /// The time interval (in seconds) between WebSocket heartbeat pings.
40    #[clap(short = 'i', long, default_value = "30")]
41    pub heartbeat_interval: u64,
42
43    /// The duration of time without hearing from a client before it is
44    /// assumed to be disconnected.
45    #[clap(short = 't', long, default_value = "120")]
46    pub heartbeat_timeout: u64,
47}