artifact-app 0.6.3

Artifact is a design doc tool made for developers. It allows anyone to easily write and link their design docs both to each other and to source code, making it easy to track how complete their project is. Documents are revision controllable, can be rendered as a static web page and have a full suite of command line tools for searching, formatting and displaying them.
Documentation

use super::types::*;

use super::super::api;

/// Get the server subcommand for the cmdline
/// Partof:
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,
}

/// pull out the command settings
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"),
    }
}

// TODO: should technically return result
// need to do conditional compilation on types
// to auto-convert web errors
pub fn run_cmd(project: Project, cmd: &Cmd) {
    api::start_api(project, &cmd.addr, cmd.edit);
}