diff --git a/src/bin/cache_check.rs b/src/bin/cache_check.rs index 94355dc..4db7e9b 100644 --- a/src/bin/cache_check.rs +++ b/src/bin/cache_check.rs @@ -13,7 +13,7 @@ use thinp::report::*; fn main() { let parser = App::new("cache_check") - .version(thinp::version::TOOLS_VERSION) + .version(thinp::version::tools_version()) .arg( Arg::with_name("INPUT") .help("Specify the input device to check") diff --git a/src/bin/cache_dump.rs b/src/bin/cache_dump.rs index edf8b4c..3f585bf 100644 --- a/src/bin/cache_dump.rs +++ b/src/bin/cache_dump.rs @@ -9,7 +9,7 @@ use thinp::cache::dump::{dump, CacheDumpOptions}; fn main() { let parser = App::new("cache_dump") - .version(thinp::version::TOOLS_VERSION) + .version(thinp::version::tools_version()) .arg( Arg::with_name("INPUT") .help("Specify the input device to check") diff --git a/src/bin/thin_check.rs b/src/bin/thin_check.rs index 307b439..1c1ea27 100644 --- a/src/bin/thin_check.rs +++ b/src/bin/thin_check.rs @@ -14,7 +14,7 @@ use thinp::thin::check::{check, ThinCheckOptions, MAX_CONCURRENT_IO}; fn main() { let parser = App::new("thin_check") - .version(thinp::version::TOOLS_VERSION) + .version(thinp::version::tools_version()) .about("Validates thin provisioning metadata on a device or file.") .arg( Arg::with_name("QUIET") diff --git a/src/bin/thin_dump.rs b/src/bin/thin_dump.rs index 3954249..3008e35 100644 --- a/src/bin/thin_dump.rs +++ b/src/bin/thin_dump.rs @@ -13,7 +13,7 @@ use thinp::thin::dump::{dump, ThinDumpOptions}; fn main() { let parser = App::new("thin_check") - .version(thinp::version::TOOLS_VERSION) + .version(thinp::version::tools_version()) .about("Validates thin provisioning metadata on a device or file.") .arg( Arg::with_name("QUIET") diff --git a/src/bin/thin_explore.rs b/src/bin/thin_explore.rs index c4918fd..aa2b54d 100644 --- a/src/bin/thin_explore.rs +++ b/src/bin/thin_explore.rs @@ -847,7 +847,7 @@ fn explore(path: &Path, node_path: Option>) -> Result<()> { fn main() -> Result<()> { let parser = App::new("thin_explore") - .version(thinp::version::TOOLS_VERSION) + .version(thinp::version::tools_version()) .about("A text user interface for examining thin metadata.") .arg( Arg::with_name("NODE_PATH") diff --git a/src/bin/thin_metadata_pack.rs b/src/bin/thin_metadata_pack.rs index d4b731f..e29678a 100644 --- a/src/bin/thin_metadata_pack.rs +++ b/src/bin/thin_metadata_pack.rs @@ -8,7 +8,7 @@ use thinp::file_utils; fn main() { let parser = App::new("thin_metadata_pack") - .version(thinp::version::TOOLS_VERSION) + .version(thinp::version::tools_version()) .about("Produces a compressed file of thin metadata. Only packs metadata blocks that are actually used.") .arg(Arg::with_name("INPUT") .help("Specify thinp metadata binary device/file") diff --git a/src/bin/thin_metadata_unpack.rs b/src/bin/thin_metadata_unpack.rs index ca6403f..0664557 100644 --- a/src/bin/thin_metadata_unpack.rs +++ b/src/bin/thin_metadata_unpack.rs @@ -10,7 +10,7 @@ use std::process::exit; fn main() { let parser = App::new("thin_metadata_unpack") - .version(thinp::version::TOOLS_VERSION) + .version(thinp::version::tools_version()) .about("Unpack a compressed file of thin metadata.") .arg( Arg::with_name("INPUT") diff --git a/src/bin/thin_restore.rs b/src/bin/thin_restore.rs index 93f62e9..243f3a4 100644 --- a/src/bin/thin_restore.rs +++ b/src/bin/thin_restore.rs @@ -13,7 +13,7 @@ use thinp::thin::restore::{restore, ThinRestoreOptions}; fn main() { let parser = App::new("thin_restore") - .version(thinp::version::TOOLS_VERSION) + .version(thinp::version::tools_version()) .about("Convert XML format metadata to binary.") .arg( Arg::with_name("OVERRIDE_MAPPING_ROOT") diff --git a/src/bin/thin_shrink.rs b/src/bin/thin_shrink.rs index b748b30..0e27f79 100644 --- a/src/bin/thin_shrink.rs +++ b/src/bin/thin_shrink.rs @@ -12,7 +12,7 @@ use thinp::file_utils; fn main() { let parser = App::new("thin_shrink") - .version(thinp::version::TOOLS_VERSION) + .version(thinp::version::tools_version()) .about("Rewrite xml metadata and move data in an inactive pool.") .arg( Arg::with_name("INPUT") diff --git a/src/version.rs b/src/version.rs index fe73777..19ea2d5 100644 --- a/src/version.rs +++ b/src/version.rs @@ -1 +1,5 @@ -pub const TOOLS_VERSION: &str = include_str!("../VERSION"); +const TOOLS_VERSION: &str = include_str!("../VERSION"); + +pub fn tools_version() -> &'static str { + TOOLS_VERSION.trim_end() +} diff --git a/tests/cache_check.rs b/tests/cache_check.rs index 8d92e5d..41c81bb 100644 --- a/tests/cache_check.rs +++ b/tests/cache_check.rs @@ -1,6 +1,6 @@ use anyhow::Result; use duct::cmd; -use thinp::version::TOOLS_VERSION; +use thinp::version::tools_version; mod common; @@ -12,14 +12,14 @@ use common::*; #[test] fn accepts_v() -> Result<()> { let stdout = cache_check!("-V").read()?; - assert_eq!(stdout, TOOLS_VERSION); + assert_eq!(stdout, tools_version()); Ok(()) } #[test] fn accepts_version() -> Result<()> { let stdout = cache_check!("--version").read()?; - assert_eq!(stdout, TOOLS_VERSION); + assert_eq!(stdout, tools_version()); Ok(()) } diff --git a/tests/thin_check.rs b/tests/thin_check.rs index c31b31b..498612f 100644 --- a/tests/thin_check.rs +++ b/tests/thin_check.rs @@ -1,6 +1,6 @@ use anyhow::Result; use thinp::file_utils; -use thinp::version::TOOLS_VERSION; +use thinp::version::tools_version; mod common; @@ -13,14 +13,14 @@ use common::*; #[test] fn accepts_v() -> Result<()> { let stdout = thin_check!("-V").read()?; - assert_eq!(stdout, TOOLS_VERSION); + assert_eq!(stdout, tools_version()); Ok(()) } #[test] fn accepts_version() -> Result<()> { let stdout = thin_check!("--version").read()?; - assert_eq!(stdout, TOOLS_VERSION); + assert_eq!(stdout, tools_version()); Ok(()) } diff --git a/tests/thin_delta.rs b/tests/thin_delta.rs index 458a307..337ac57 100644 --- a/tests/thin_delta.rs +++ b/tests/thin_delta.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use thinp::version::TOOLS_VERSION; +use thinp::version::tools_version; mod common; use common::test_dir::*; @@ -10,14 +10,14 @@ use common::*; #[test] fn accepts_v() -> Result<()> { let stdout = thin_delta!("-V").read()?; - assert_eq!(stdout, TOOLS_VERSION); + assert_eq!(stdout, tools_version()); Ok(()) } #[test] fn accepts_version() -> Result<()> { let stdout = thin_delta!("--version").read()?; - assert_eq!(stdout, TOOLS_VERSION); + assert_eq!(stdout, tools_version()); Ok(()) } diff --git a/tests/thin_metadata_pack.rs b/tests/thin_metadata_pack.rs index 131cc95..84e3187 100644 --- a/tests/thin_metadata_pack.rs +++ b/tests/thin_metadata_pack.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use thinp::version::TOOLS_VERSION; +use thinp::version::tools_version; mod common; use common::test_dir::*; @@ -10,14 +10,14 @@ use common::*; #[test] fn accepts_v() -> Result<()> { let stdout = thin_metadata_pack!("-V").read()?; - assert!(stdout.contains(TOOLS_VERSION)); + assert!(stdout.contains(tools_version())); Ok(()) } #[test] fn accepts_version() -> Result<()> { let stdout = thin_metadata_pack!("--version").read()?; - assert!(stdout.contains(TOOLS_VERSION)); + assert!(stdout.contains(tools_version())); Ok(()) } diff --git a/tests/thin_metadata_unpack.rs b/tests/thin_metadata_unpack.rs index 33d3f0c..7a5d5ee 100644 --- a/tests/thin_metadata_unpack.rs +++ b/tests/thin_metadata_unpack.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use thinp::version::TOOLS_VERSION; +use thinp::version::tools_version; mod common; use common::test_dir::*; @@ -10,14 +10,14 @@ use common::*; #[test] fn accepts_v() -> Result<()> { let stdout = thin_metadata_unpack!("-V").read()?; - assert!(stdout.contains(TOOLS_VERSION)); + assert!(stdout.contains(tools_version())); Ok(()) } #[test] fn accepts_version() -> Result<()> { let stdout = thin_metadata_unpack!("--version").read()?; - assert!(stdout.contains(TOOLS_VERSION)); + assert!(stdout.contains(tools_version())); Ok(()) } diff --git a/tests/thin_repair.rs b/tests/thin_repair.rs index 19f7969..bc836d6 100644 --- a/tests/thin_repair.rs +++ b/tests/thin_repair.rs @@ -1,6 +1,6 @@ use anyhow::Result; use std::str::from_utf8; -use thinp::version::TOOLS_VERSION; +use thinp::version::tools_version; mod common; use common::test_dir::*; @@ -11,14 +11,14 @@ use common::*; #[test] fn accepts_v() -> Result<()> { let stdout = thin_repair!("-V").read()?; - assert_eq!(stdout, TOOLS_VERSION); + assert_eq!(stdout, tools_version()); Ok(()) } #[test] fn accepts_version() -> Result<()> { let stdout = thin_repair!("--version").read()?; - assert_eq!(stdout, TOOLS_VERSION); + assert_eq!(stdout, tools_version()); Ok(()) } diff --git a/tests/thin_restore.rs b/tests/thin_restore.rs index c8efa45..d2b85d0 100644 --- a/tests/thin_restore.rs +++ b/tests/thin_restore.rs @@ -1,7 +1,7 @@ use anyhow::Result; use std::str::from_utf8; use thinp::file_utils; -use thinp::version::TOOLS_VERSION; +use thinp::version::tools_version; mod common; use common::test_dir::*; @@ -12,14 +12,14 @@ use common::*; #[test] fn accepts_v() -> Result<()> { let stdout = thin_restore!("-V").read()?; - assert_eq!(stdout, TOOLS_VERSION); + assert_eq!(stdout, tools_version()); Ok(()) } #[test] fn accepts_version() -> Result<()> { let stdout = thin_restore!("--version").read()?; - assert_eq!(stdout, TOOLS_VERSION); + assert_eq!(stdout, tools_version()); Ok(()) } diff --git a/tests/thin_rmap.rs b/tests/thin_rmap.rs index 3797edf..7b2eaba 100644 --- a/tests/thin_rmap.rs +++ b/tests/thin_rmap.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use thinp::version::TOOLS_VERSION; +use thinp::version::tools_version; mod common; use common::test_dir::*; @@ -10,14 +10,14 @@ use common::*; #[test] fn accepts_v() -> Result<()> { let stdout = thin_rmap!("-V").read()?; - assert_eq!(stdout, TOOLS_VERSION); + assert_eq!(stdout, tools_version()); Ok(()) } #[test] fn accepts_version() -> Result<()> { let stdout = thin_rmap!("--version").read()?; - assert_eq!(stdout, TOOLS_VERSION); + assert_eq!(stdout, tools_version()); Ok(()) }