journal_sdk/
config.rs

1use clap::Parser;
2
3#[derive(Parser, Debug)]
4#[command(
5    author,
6    version,
7    about = "Deploy a Synchronic Web Journal Software Development Kit (SDK) as a local webserver"
8)]
9pub struct Config {
10    #[arg(short, long, default_value_t = String::from(""), help = "Path to the persistent database")]
11    pub database: String,
12
13    #[arg(
14        short,
15        long,
16        default_value_t = 4096,
17        help = "Port to access the webserver"
18    )]
19    pub port: u16,
20
21    #[arg(short, long, default_value_t = String::from(""), help = "Initial script to pass into the Journal")]
22    pub boot: String,
23
24    #[arg(short, long, default_value_t = String::from(""), help = "If set, then evaluate the provided query, print, and exit immediately")]
25    pub evaluate: String,
26
27    #[arg(short, long, default_value_t = String::from(""), help = "Contents of the step query")]
28    pub step: String,
29
30    #[arg(
31        short = 'c',
32        long,
33        default_value_t = 0,
34        help = "Power of two determining the period of the step query"
35    )]
36    pub periodicity: i32,
37}
38
39impl Config {
40    pub fn new() -> Self {
41        Config::parse()
42    }
43}