fn run_cmd(matches: &ArgMatches) -> Result<PathBuf, failure::Error>
{
    // Prepare a temporary location for generating the Rust package.
    // We will execute "cargo fmt" within this package to format the input file.
    let temp = std::env::temp_dir();
    let unique_name;
    {
        let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
        unique_name = format!("intercom-fmt-{0}_{1}", now.as_secs(), now.subsec_micros());
    }
    let temp = temp.join(&unique_name);
    std::fs::create_dir_all(&temp)?;

    // Prepare the cargo package.
    generate_cargo_toml(&unique_name, &temp)?;
    let for_output = copy_as_source(&mut get_input(matches)?, &temp)?;

    // Format the output with "cargo fmt".
    run_cargo_fmt(&temp)?;

    std::io::copy(
        &mut File::open(for_output.as_ref())?,
        get_output(&matches)?.as_mut(),
    )?;
    Ok(temp)
}
/// Executes the command based on the given command line parameters.
Executes the command based on the given command line parameters.
Executes the command based on the given command line parameters .
fn run_cmd(matches: &ArgMatches) -> Result<PathBuf, failure::Error>
{
    // Prepare a temporary location for generating the Rust package.
    // We will execute "cargo fmt" within this package to format the input file.
    let temp = std::env::temp_dir();
    let unique_name;
    {
        let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
        unique_name = format!("intercom-fmt-{0}_{1}", now.as_secs(), now.subsec_micros());
    }
    let temp = temp.join(&unique_name);
    std::fs::create_dir_all(&temp)?;
    // Prepare the cargo package.
    generate_cargo_toml(&unique_name, &temp)?;
    let for_output = copy_as_source(&mut get_input(matches)?, &temp)?;
    // Format the output with "cargo fmt".
    run_cargo_fmt(&temp)?;
    std::io::copy(
        &mut File::open(for_output.as_ref())?,
        get_output(&matches)?.as_mut(),
    )?;
    Ok(temp)
}
fn run_cmd ( matches : & ArgMatches ) -> Result < PathBuf , failure :: Error > { // Prepare a temporary location for generating the Rust package. // We will execute "cargo fmt" within this package to format the input file. let temp = std :: env :: temp_dir ( ) ; let unique_name ; { let now = SystemTime :: now ( ) . duration_since ( UNIX_EPOCH ) . unwrap ( ) ; unique_name = format ! ( " " now as_secs ( ) now subsec_micros ( ) ) ; } let temp = temp . join ( & unique_name ) ; std :: fs :: create_dir_all ( & temp ) ? ; // Prepare the cargo package. generate_cargo_toml ( & unique_name , & temp ) ? ; let for_output = copy_as_source ( & mut get_input ( matches ) ? , & temp ) ? ; // Format the output with "cargo fmt". run_cargo_fmt ( & temp ) ? ; std :: io :: copy ( & mut File :: open ( for_output . as_ref ( ) ) ? , get_output ( & matches ) ? . as_mut ( ) , ) ? ; Ok ( temp ) }
Executes the command based on the given command line parameters.
Executes the command based on the given command line parameters .
matches
&ArgMatches
matches
&ArgMatches