1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use crate::{repo, Config, Exec, Location};
use structopt::StructOpt;
#[derive(StructOpt, Debug)]
#[structopt(about = "Print repository's full path")]
pub struct Opt {
#[structopt(short, long, help = "Use regular expressions")]
pub regex: bool,
#[structopt(help = Location::about())]
pub target: Location,
}
impl Exec for Opt {
fn exec(self, config: Config) -> i32 {
match repo::unique(&config.src, self.target, self.regex) {
Ok(path) => {
println!("{}", path.display());
0
}
Err(err) => {
info!("{}", err);
1
}
}
}
}