use super::types::*;
use super::super::api;
pub fn get_subcommand<'a, 'b>() -> App<'a, 'b> {
SubCommand::with_name("server")
.about("start the web-ui server")
.settings(&[AS::DeriveDisplayOrder, COLOR])
.arg(Arg::with_name("addr")
.help("full address to start server on. Default='127.0.0.1:8000'")
.use_delimiter(false))
.arg(Arg::with_name("edit")
.long("edit")
.short("e")
.help("enable editing. ALPHA NOTICE: this feature is not yet
\
secure. DO NOT USE ON NON TRUSTED NETWORK"))
}
pub struct Cmd {
pub addr: String,
pub edit: bool,
}
pub fn get_cmd(matches: &ArgMatches) -> Cmd {
Cmd {
addr: matches.value_of("addr").unwrap_or("127.0.0.1:4000").to_string(),
edit: matches.is_present("edit"),
}
}
pub fn run_cmd(project: Project, cmd: &Cmd) {
api::start_api(project, &cmd.addr, cmd.edit);
}