pub fn import(settings: Settings, args: &ArgMatches) {
    let filename = Path::new(args.value_of("INPUT").unwrap());
    println!("Importing {:?}", filename);

    // Identify file
    let info = identify(filename);

    match info {
        // Identification succcess, copy to data dir
        Ok(info) => {
            match convert_or_copy(filename, &settings, &info) {
                // copy or conversion success, add to database
                Ok(filename) => save_to_db(&filename, &info, &args, &settings),

                // print error message
                Err(err) => println!("Error: {}", err),
            }
        }

        // print error message
        Err(err) => {
            println!("Error parsing metadata: {:?}", err);
        }
    }
}
/// Import command, reads metadata from file, copies file into managed 
/// data directory and inserts information into DB
Import command, reads metadata from file, copies file into managed
data directory and inserts information into DB
Import command reads metadata from file copies file into managed data directory and inserts information into DB
pub fn import(settings: Settings, args: &ArgMatches) {
    let filename = Path::new(args.value_of("INPUT").unwrap());
    println!("Importing {:?}", filename);
    // Identify file
    let info = identify(filename);
    match info {
        // Identification succcess, copy to data dir
        Ok(info) => {
            match convert_or_copy(filename, &settings, &info) {
                // copy or conversion success, add to database
                Ok(filename) => save_to_db(&filename, &info, &args, &settings),
                // print error message
                Err(err) => println!("Error: {}", err),
            }
        }
        // print error message
        Err(err) => {
            println!("Error parsing metadata: {:?}", err);
        }
    }
}
pub fn import ( settings : Settings , args : & ArgMatches ) { let filename = Path :: new ( args . value_of ( " " ) . unwrap ( ) ) ; println ! ( " " filename ) ; // Identify file let info = identify ( filename ) ; match info { // Identification succcess, copy to data dir Ok ( info ) => { match convert_or_copy ( filename , & settings , & info ) { // copy or conversion success, add to database Ok ( filename ) => save_to_db ( & filename , & info , & args , & settings ) , // print error message Err ( err ) => println ! ( " " err ) , } } // print error message Err ( err ) => { println ! ( " " err ) ; } } }
Import command, reads metadata from file, copies file into managed
data directory and inserts information into DB
Import command reads metadata from file copies file into managed data directory and inserts information into DB
settings
Settings
args
&ArgMatches
settings
Settings
args
&ArgMatches