use structopt::StructOpt; use crate::{Settings, UrlMap, db::backend::Connectable}; mod migrate; mod run_server; #[derive(StructOpt)] enum Command { Migrate(migrate::Migrate), RunServer(run_server::RunServer), } impl Command { fn execute(self, urls: UrlMap, settings: Settings) { match self { 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); }