about summary refs log tree commit diff stats
path: root/crates/rocie-server/src/cli.rs
blob: b2ec214527dbc6333eabed8550993275f2b79158 (plain) (blame)
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
use std::path::PathBuf;

use clap::{Parser, Subcommand};

#[derive(Parser)]
pub(crate) struct CliArgs {
    #[command(subcommand)]
    pub(crate) command: Command,
}

#[derive(Subcommand)]
pub(crate) enum Command {
    /// Serve the server.
    Serve {
        /// Which port to serve the server on.
        #[arg(short, long, default_value = "8080")]
        port: u16,

        /// Which host to serve the server on.
        #[arg(short = 'b', long, default_value = "127.0.0.1")]
        host: String,

        /// Path to the database to use to store data.
        #[arg(short, long, env = "ROCIE_DB_PATH")]
        db_path: PathBuf,
    },

    /// Print the `OpenAPI` API documentation to stdout.
    OpenApi,
}