From 9390cd3eb1a128dab81dd26b60265a027da26bd5 Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Fri, 5 Mar 2021 06:48:20 -0500 Subject: added version message --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0846e39..25c4169 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,4 +2,4 @@ # It is not intended for manual editing. [[package]] name = "titler" -version = "1.1.0" +version = "1.1.1" diff --git a/Cargo.toml b/Cargo.toml index 54e7819..6a52465 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "titler" -version = "1.1.0" +version = "1.1.1" authors = ["Adam T. Carpenter "] edition = "2018" diff --git a/src/main.rs b/src/main.rs index fe1d0eb..f9222c8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,8 +4,11 @@ use std::io::{prelude::*, stdin, stdout, BufReader, BufWriter}; const HELP_MSG: &str = "Title-Case Tool\n\ -h | --help\t\t\tPrints this message\n\ + -v | --version\t\t\tPrints version number\n\ -i | --ignore [word...]\t\tA list of words that should not be corrected"; +const VERSION_MSG: &str = env!("CARGO_PKG_VERSION"); + /// Words that will not be capitalized unless they are at the start or end of a title. const EXCEPTIONS: &[&str] = &[ "vs", "above", "across", "against", "at", "between", "by", "along", "among", "down", "in", @@ -37,6 +40,10 @@ fn main() { println!("{}", HELP_MSG); return; } + "--version" | "-v" => { + println!("{}", VERSION_MSG); + return; + } unrecognized => { panic!(format!("Unrecognized option: {}", unrecognized)); } -- cgit v1.2.3