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
|
use structopt::StructOpt;
use crate::{Settings, UrlMap};
mod make_migrations;
mod migrate;
mod run_server;
#[derive(StructOpt)]
enum Command {
MakeMigrations(make_migrations::MakeMigrations),
Migrate(migrate::Migrate),
RunServer(run_server::RunServer),
}
impl Command {
fn execute(self, urls: UrlMap, settings: Settings) {
match self {
Command::MakeMigrations(command) => command.execute(urls, settings),
Command::Migrate(command) => command.execute(urls, settings),
Command::RunServer(command) => command.execute(urls, settings),
}
}
}
pub fn main(urls: UrlMap, settings: Settings) {
let command = Command::from_args();
command.execute(urls, settings);
}
|