fn execute(m: &ArgMatches) -> Result<(), String> {
    // get inputs
    let input = m.value_of("INPUT");
    let output = m.value_of("OUTPUT");
    let template = m.value_of("TEMPLATE");
    let add_title = !m.is_present("NO_TITLE");
    let add_badges = !m.is_present("NO_BADGES");
    let add_license = !m.is_present("NO_LICENSE");
    let no_template = m.is_present("NO_TEMPLATE");
    let indent_headings = !m.is_present("NO_INDENT_HEADINGS");

    // get project root
    let project_root = helper::get_project_root(m.value_of("ROOT"))?;

    // get source file
    let mut source = helper::get_source(&project_root, input)?;

    // get destination file
    let mut dest = helper::get_dest(&project_root, output)?;

    // get template file
    let mut template_file = if no_template {
        None
    } else {
        helper::get_template_file(&project_root, template)?
    };

    // generate output
    let readme = cargo_readme::generate_readme(
        &project_root,
        &mut source,
        template_file.as_mut(),
        add_title,
        add_badges,
        add_license,
        indent_headings,
    )?;

    helper::write_output(&mut dest, readme)
}
/// Takes the arguments matches from clap and outputs the result, either to stdout of a file
Takes the arguments matches from clap and outputs the result, either to stdout of a file
Takes the arguments matches from clap and outputs the result either to stdout of a file
fn execute(m: &ArgMatches) -> Result<(), String> {
    // get inputs
    let input = m.value_of("INPUT");
    let output = m.value_of("OUTPUT");
    let template = m.value_of("TEMPLATE");
    let add_title = !m.is_present("NO_TITLE");
    let add_badges = !m.is_present("NO_BADGES");
    let add_license = !m.is_present("NO_LICENSE");
    let no_template = m.is_present("NO_TEMPLATE");
    let indent_headings = !m.is_present("NO_INDENT_HEADINGS");
    // get project root
    let project_root = helper::get_project_root(m.value_of("ROOT"))?;
    // get source file
    let mut source = helper::get_source(&project_root, input)?;
    // get destination file
    let mut dest = helper::get_dest(&project_root, output)?;
    // get template file
    let mut template_file = if no_template {
        None
    } else {
        helper::get_template_file(&project_root, template)?
    };
    // generate output
    let readme = cargo_readme::generate_readme(
        &project_root,
        &mut source,
        template_file.as_mut(),
        add_title,
        add_badges,
        add_license,
        indent_headings,
    )?;
    helper::write_output(&mut dest, readme)
}
fn execute ( m : & ArgMatches ) -> Result < ( ) , String > { // get inputs let input = m . value_of ( " " ) ; let output = m . value_of ( " " ) ; let template = m . value_of ( " " ) ; let add_title = ! m . is_present ( " " ) ; let add_badges = ! m . is_present ( " " ) ; let add_license = ! m . is_present ( " " ) ; let no_template = m . is_present ( " " ) ; let indent_headings = ! m . is_present ( " " ) ; // get project root let project_root = helper :: get_project_root ( m . value_of ( " " ) ) ? ; // get source file let mut source = helper :: get_source ( & project_root , input ) ? ; // get destination file let mut dest = helper :: get_dest ( & project_root , output ) ? ; // get template file let mut template_file = if no_template { None } else { helper :: get_template_file ( & project_root , template ) ? } ; // generate output let readme = cargo_readme :: generate_readme ( & project_root , & mut source , template_file . as_mut ( ) , add_title , add_badges , add_license , indent_headings , ) ? ; helper :: write_output ( & mut dest , readme ) }
Takes the arguments matches from clap and outputs the result, either to stdout of a file
Takes the arguments matches from clap and outputs the result either to stdout of a file
m
&ArgMatches