Skip to content

Commit 85e6967

Browse files
kachickadamreichold
authored andcommitted
Add version flag in executable
1 parent 381a4bd commit 85e6967

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

scraper/src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ fn main() {
6666
opts.optflag("t", "text", "output text of elements");
6767
opts.optflag("h", "help", "this cruft");
6868
opts.optopt("", "install-man-page", "install real documentation", "PATH");
69+
opts.optflag("", "version", "output version number");
6970

7071
let args: Vec<String> = env::args().collect();
7172
let matches = match opts.parse(&args[1..]) {
@@ -79,6 +80,10 @@ fn main() {
7980
);
8081
return;
8182
}
83+
if matches.opt_present("version") {
84+
println!("{} {}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"));
85+
return;
86+
}
8287

8388
if let Some(path) = matches.opt_str("install-man-page") {
8489
let mut path = PathBuf::from(path);

0 commit comments

Comments
 (0)