aboutsummaryrefslogtreecommitdiff
path: root/src/cli/mod.rs
blob: c656c1c58c89c0ec358785e921ec69188357f4d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use structopt::StructOpt;

use crate::{Settings, UrlMap};

mod run_server;

#[derive(StructOpt)]
enum Command {
    RunServer(run_server::RunServer),
}

impl Command {
    fn execute(self, urls: UrlMap, settings: Settings) {
        match self {
            Command::RunServer(command) => command.execute(urls, settings),
        }
    }
}

pub fn main(urls: UrlMap, settings: Settings) {
    let command = Command::from_args();
    command.execute(urls, settings);
}