rash 0.6.0

Rust-based file hashing tool
use clap::{App, Arg, SubCommand, AppSettings};

pub fn build_cli() -> App<'static, 'static>{
    app_from_crate!()
        .setting(AppSettings::SubcommandRequiredElseHelp)
        .subcommand(SubCommand::with_name("md5")
            .about("MD5 algorithm")
            .long_about("MD5 algorithm. This algorithm has known vulnerabilities, use a more modern algorithm."))
        .subcommand(SubCommand::with_name("whirlpool")
            .about("whirlpool algorithm"))
        .subcommand(SubCommand::with_name("sha1")
            .about("SHA1 algorithm")
            .long_about("SHA1 algorithm. This algorithm has known vulnerabilities, use a more modern algorithm."))
        .subcommand(SubCommand::with_name("ripemd160")
            .about("Ripemd160 algorithm"))
        .subcommand(SubCommand::with_name("blake2b")
            .about("BLAKE2b algorithm")
            .long_about("BLAKE2b algorithm. Recommended over BLAKE2s on 64bit platforms.")
            .arg(Arg::with_name("len")
                .short("l")
                .long("length")
                .help("Length of output hash in bytes")
                .long_help("Length of output hash in bytes. Must be between 1 & 64 inclusive.")
                .default_value("64")))
        .subcommand(SubCommand::with_name("blake2s")
            .about("BLAKE2s algorithm")
            .long_about("BLAKE2s algorithm. Recommended over BLAKE2b on 32bit platforms.")
            .arg(Arg::with_name("len")
                .short("l")
                .long("length")
                .help("Length of output hash in bytes")
                .long_help("Length of output hash in bytes. Must be between 1 & 32 inclusive.")
                .default_value("32")))
        .subcommand(SubCommand::with_name("sha2")
            .about("SHA2 algorithms")
            .long_about("SHA2 Algorithms. Supports SHA256 (truncated to 224, 256) and SHA512 (truncated to 224, 256, 384, 512).")
            .arg(Arg::with_name("len")
                .short("l")
                .long("length")
                .help("Length of output hash")
                .long_help("Length of the output hash. Supported lengths with algorithms:\
                \n\talg:\tlen\
                \n\t256:\t224, 256\
                \n\t512:\t224, 256, 384, 512\n")
                .possible_values(&["224", "256", "384", "512"])
                .default_value_ifs(&[("alg", Some("512"), "512"),("alg", Some("256"), "256")])
                .takes_value(true))
            .arg(Arg::with_name("alg")
                .short("a")
                .long("algorithm")
                .help("SHA2 algorithm")
                .takes_value(true)
                .default_value("512")
                .possible_values(&["256", "512"])))
        .subcommand(SubCommand::with_name("sha3")
            .about("SHA3 algorithms")
            .arg(Arg::with_name("len")
                .short("l")
                .long("length")
                .help("Length of output hash")
                .long_help("Length of the output hash. Supported lengths with algorithms:\
                \n\talg:\tlen\
                \n\tsha3:\t244, 256, 384, 512\
                \n\tkeccak:\t244, 256, 384, 512\n")
                .default_value_ifs(&[("alg", Some("sha3"), "512"), ("alg", Some("keccak"), "512")])
                .takes_value(true))
            .arg(Arg::with_name("alg")
                .short("a")
                .long("algorithm")
                .help("SHA3 Algorithm")
                .long_help("The SHA3 algorithm to use. If not given, sha3 is assumed. See len's help for length algorithm combinations.")
                .takes_value(true)
                .possible_values(&["sha3", "keccak"])
                .default_value("sha3")))
        .subcommand(SubCommand::with_name("shake")
            .about("Shake algorithm")
            .arg(Arg::with_name("len")
                .short("l")
                .long("length")
                .help("Length of output hash")
                .long_help("Length of output hash. Can be any positive integer.")
                .takes_value(true)
                .required(true))
            .arg(Arg::with_name("var")
                .short("v")
                .long("variant")
                .help("Shake variant")
                .possible_values(&["128", "256"])
                .default_value("256")))
        .subcommand(SubCommand::with_name("groestl")
            .about("Groestl Algorithm")
            .arg(Arg::with_name("len")
                .short("l")
                .long("length")
                .help("Length of output hash")
                .long_help("Length of output. Must be between 1 & 64 inclusive.")
                .default_value("64")
                .takes_value(true)))
        .arg(Arg::with_name("FILE")
            .help("File to calculate the hash of")
            .global(true))
}