vimpunk / cratetorrent

A BitTorrent V1 engine library for Rust (and currently Linux)
473 stars 35 forks source link

cratetorrent-cli Mode and Metainfo options conflict #93

Closed jabedude closed 3 years ago

jabedude commented 3 years ago

The master branch (I checked out at 0a6225b4e626c2ff13f37c4c3f1469fdcc1795f2) contains an issue in the cratetorrent-cli utility. There are two options specifying a short "-m" option in the StructOpt argument parsing code:

#[derive(StructOpt, Debug)]
pub struct Args {
    /// Whether to 'seed' or 'download' the torrent.
    #[structopt(
        short,
        long,
        parse(from_str = parse_mode),
        default_value = "Mode::Download { seeds: Vec::new() }",
    )]
....
    mode: Mode,
    /// The path to the torrent metainfo file.
    #[structopt(short, long)]
    metainfo: PathBuf,
....
}

This leads to this issue:

 $ cratetorrent (master) → ./target/debug/cratetorrent-cli --help
thread 'main' panicked at 'Argument short must be unique

        -m is already in use', /home/josh/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-2.33.3/src/app/parser.rs:193:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
vimpunk commented 3 years ago

Thanks! Fixed by #92 .

jabedude commented 3 years ago

Great :) Didn't see that PR!