You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: main.rs
    path of file: ./repos/coreutils/mv/src
    
    the code of the file until where you have to start completion: use std::{
    fs,
    path::{Path, PathBuf},
};

use clap::ArgMatches;
use coreutils_core::{backup::*, input::*};

mod cli;

fn main() {
    let matches = cli::create_app().get_matches();

    let flags = MvFlags::from_matches(&matches);

    let sources: Vec<PathBuf> = {
        let strip = flags.strip_trailing_slashes;

        // "SOURCE" is required, so it is ok to unwrap
        matches
            .values_of("SOURCE")
            .unwrap()
            .map(Path::new)
            .map(|val| if strip { val.components().as_path() } else { val })
            .map(|val| val.to_owned())
            .collect()
    };

    let success = if !flags.target_directory.is_empty() {
        move_files(sources, &PathBuf::from(&flags.target_directory), &flags)
    } else if !flags.no_target_directory && sources.last().unwrap().is_dir() {
        let target = sources.last().unwrap();
        move_files(sources[..sources.len() - 1].to_vec(), target, &flags)
    } else if sources.len() == 2 {
        rename_file(&sources[0], &sources[1], &flags)
    } else if sources.len() == 1 {
        eprintln!("mv: No target supplied");
        false
    } else {
        let target = sources.last().unwrap();
        move_files(sources[..sources.len() - 1].to_vec(), target, &flags)
    };

    if !success {
        std::process::exit(1);
    }
}

    
fn rename_file(curr: &Path, new: &Path, flags: &MvFlags) -> bool {
    if new.exists() {
        match &flags.overwrite {
            OverwriteMode::Force => {},
            OverwriteMode::Interactive => {
                let is_affirmative = Input::new()
                    .with_msg(&format!("mv: overwrite '{}'?", new.display()))
                    .with_err_msg("mv: could not read user input")
                    .is_affirmative();
                if !is_affirmative {
                    return true;
                }
            },
            OverwriteMode::NoClobber => return true,
        };

        if flags.update && file_older(curr, new) {
            return true;
        }

        let res = match &flags.backup {
            BackupMode::Numbered => Some(create_numbered_backup(new)),
            BackupMode::Existing => Some(create_existing_backup(new, &flags.suffix)),
            BackupMode::Simple => Some(create_simple_backup(new, &flags.suffix)),
            BackupMode::None => None,
        };

        if let Some(res) = res {
            match res {
                Ok(file) => println!("mv: Created backup file {}", file.display()),
                Err(err) => {
                    eprintln!("mv: Backup failed: {}", err);
                    return false;
                },
            };
        }
    }

    match fs::rename(curr, new) {
        Ok(()) => {
            if flags.verbose {
                println!("mv: Renamed {} to {}", curr.display(), new.display());
            }

            true
        },
        Err(msg) => {
            eprintln!("mv: Cannot rename {}: {}", curr.display(), msg);
            false
        },
    }
}