fn directory(paths: Vec<String>, b: Behavior) -> i32 {
    if paths.is_empty() {
        println!("{} with -d requires at least one argument.", executable!());
        1
    } else {
        let mut all_successful = true;

        for directory in paths.iter() {
            let path = Path::new(directory);

            // if the path already exist, don't try to create it again
            if !path.exists() {
                if let Err(e) = fs::create_dir(directory) {
                    show_info!("{}: {}", path.display(), e.to_string());
                    all_successful = false;
                }
            }

            if mode::chmod(&path, b.mode()).is_err() {
                all_successful = false;
            }

            if b.verbose {
                show_info!("created directory '{}'", path.display());
            }
        }
        if all_successful {
            0
        } else {
            1
        }
    }
}
/// Creates directories.
///
/// GNU man pages describe this functionality as creating 'all components of
/// the specified directories'.
///
/// Returns an integer intended as a program return code.
///
Creates directories.
GNU man pages describe this functionality as creating 'all components of
the specified directories'.

Returns an integer intended as a program return code.
Creates directories . GNU man pages describe this functionality as creating ' all components of the specified directories ' . Returns an integer intended as a program return code .
fn directory(paths: Vec<String>, b: Behavior) -> i32 {
    if paths.is_empty() {
        println!("{} with -d requires at least one argument.", executable!());
        1
    } else {
        let mut all_successful = true;
        for directory in paths.iter() {
            let path = Path::new(directory);
            // if the path already exist, don't try to create it again
            if !path.exists() {
                if let Err(e) = fs::create_dir(directory) {
                    show_info!("{}: {}", path.display(), e.to_string());
                    all_successful = false;
                }
            }
            if mode::chmod(&path, b.mode()).is_err() {
                all_successful = false;
            }
            if b.verbose {
                show_info!("created directory '{}'", path.display());
            }
        }
        if all_successful {
            0
        } else {
            1
        }
    }
}
fn directory ( paths : Vec < String > , b : Behavior ) -> i32 { if paths . is_empty ( ) { println ! ( " " executable ( ) ) ; 1 } else { let mut all_successful = true ; for directory in paths . iter ( ) { let path = Path :: new ( directory ) ; // if the path already exist, don't try to create it again if ! path . exists ( ) { if let Err ( e ) = fs :: create_dir ( directory ) { show_info ! ( " " path display ( ) e to_string ( ) ) ; all_successful = false ; } } if mode :: chmod ( & path , b . mode ( ) ) . is_err ( ) { all_successful = false ; } if b . verbose { show_info ! ( " " path display ( ) ) ; } } if all_successful { 0 } else { 1 } } }
Creates directories.
Creates directories .
paths
Vec<String>
b
Behavior
paths
Vec<String>
b
Behavior