hex_dump 0.1.5

A CLI that can read print and modify binary file
Documentation
#[allow(warnings)]
fn main() -> std::io::Result<()> {
    use doe::*;
    use hex_dump::hex_vec::desplay_hex;
    use hex_dump::hex_vec::find_position;
    use hex_dump::hex_vec::read_file;
    use hex_dump::hex_vec::*;
    let args: Vec<String> = std::env::args().collect();
    match args.iter().nth(1) {
        Some(file_name) => {
            let buf = read_file(file_name)?;
            if args.len() == 5 {
                let adress = vec_element_clone!(args, 2);
                let column = vec_element_clone!(args, 3);
                let new_hex: String = vec_element_clone!(args, 4);
                // if is new_hex line "52 61 69 6E 62 6F 77 20 48 43"
                if new_hex.split(" ").collect::<Vec<_>>().len() > 1 {
                    let mut hex_vec = buf.hex_vec.clone();
                    let mut start_col = column.clone().parse::<usize>().unwrap();
                    for hex in new_hex.split_to_vec(" ") {
                        if let Ok(position) =
                            find_position(buf.address_vec.clone(), adress.clone(), start_col)
                        {
                            if let Some(elem) = hex_vec.get_mut(position) {
                                if let Ok(byte) = u8::from_str_radix(&hex, 16) {
                                    *elem = byte;
                                }
                            }
                        }
                        start_col += 1;
                    }
                    std::fs::write(file_name, &hex_vec)?;
                } else {
                    // else
                    if let Ok(position) = find_position(
                        buf.address_vec,
                        adress,
                        column.clone().parse::<usize>().unwrap(),
                    ) {
                        let mut hex_vec = buf.hex_vec.clone();
                        if let Some(elem) = hex_vec.get_mut(position) {
                            if let Ok(byte) = u8::from_str_radix(&new_hex, 16) {
                                *elem = byte;
                            }
                        }
                        std::fs::write(file_name, &hex_vec)?;
                    }
                }
            } else {
                desplay_hex(buf.hex_vec)?;
            }
        }
        None => {
            println(format!("USEAGE:"));
            println(format!("hex_dump <file>"));
            println(format!(
                "hex_dump <file> <adress> <column_num> <new_hex_value>"
            ));
            println(format!("Example:"));
            println(format!("hex_dump demo.txt                => Display hex"));
            println(format!("hex_dump demo.txt 00000020 11 2E => Modify that hex value of address is 00000020 and 11th column to 2E"));
            println(format!("hex_dump demo.txt 00000020 11 \"2E 54 65 6F\" => Modify that hex value of address is 00000020 and start column 11 to \"2E 54 65 6F\""));
        }
    }
    Ok(())
}