Skip to content
This repository was archived by the owner on Nov 4, 2023. It is now read-only.

Commit 6bc9e82

Browse files
committed
print version string
1 parent a29f94f commit 6bc9e82

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::io::{self, Read};
66
use rand::{thread_rng, Rng};
77
use getopts::Options;
88

9+
const VERSION: &str = "0.1.2";
910
const KANA_LO: u32 = 0x30A0;
1011
const KANA_HI: u32 = 0x30FF;
1112

@@ -27,6 +28,7 @@ fn main() {
2728
let args: Vec<String> = env::args().collect();
2829
let mut opts = Options::new();
2930
opts.optflag("h", "help", "print this help menu");
31+
opts.optflag("v", "version", "print the version");
3032
opts.optopt("k", "kana", "append N random katakana characters, up to 255", "N");
3133

3234
let matches = match opts.parse(&args[1..]) {
@@ -42,6 +44,11 @@ fn main() {
4244
return;
4345
}
4446

47+
if matches.opt_present("v") {
48+
println!("Version: {}", &VERSION);
49+
return;
50+
}
51+
4552
let kata_opt = matches.opt_str("k");
4653
let mut num_kata: u8 = match kata_opt {
4754
Some(x) => {

0 commit comments

Comments
 (0)