[all] Fix newline in version string

This commit is contained in:
Ming-Hung Tsai 2021-05-12 02:12:11 +08:00
parent 965fbb6e8f
commit b7bf82b8f2
18 changed files with 38 additions and 34 deletions

View File

@ -13,7 +13,7 @@ use thinp::report::*;
fn main() { fn main() {
let parser = App::new("cache_check") let parser = App::new("cache_check")
.version(thinp::version::TOOLS_VERSION) .version(thinp::version::tools_version())
.arg( .arg(
Arg::with_name("INPUT") Arg::with_name("INPUT")
.help("Specify the input device to check") .help("Specify the input device to check")

View File

@ -9,7 +9,7 @@ use thinp::cache::dump::{dump, CacheDumpOptions};
fn main() { fn main() {
let parser = App::new("cache_dump") let parser = App::new("cache_dump")
.version(thinp::version::TOOLS_VERSION) .version(thinp::version::tools_version())
.arg( .arg(
Arg::with_name("INPUT") Arg::with_name("INPUT")
.help("Specify the input device to check") .help("Specify the input device to check")

View File

@ -14,7 +14,7 @@ use thinp::thin::check::{check, ThinCheckOptions, MAX_CONCURRENT_IO};
fn main() { fn main() {
let parser = App::new("thin_check") 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.") .about("Validates thin provisioning metadata on a device or file.")
.arg( .arg(
Arg::with_name("QUIET") Arg::with_name("QUIET")

View File

@ -13,7 +13,7 @@ use thinp::thin::dump::{dump, ThinDumpOptions};
fn main() { fn main() {
let parser = App::new("thin_check") 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.") .about("Validates thin provisioning metadata on a device or file.")
.arg( .arg(
Arg::with_name("QUIET") Arg::with_name("QUIET")

View File

@ -847,7 +847,7 @@ fn explore(path: &Path, node_path: Option<Vec<u64>>) -> Result<()> {
fn main() -> Result<()> { fn main() -> Result<()> {
let parser = App::new("thin_explore") 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.") .about("A text user interface for examining thin metadata.")
.arg( .arg(
Arg::with_name("NODE_PATH") Arg::with_name("NODE_PATH")

View File

@ -8,7 +8,7 @@ use thinp::file_utils;
fn main() { fn main() {
let parser = App::new("thin_metadata_pack") 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.") .about("Produces a compressed file of thin metadata. Only packs metadata blocks that are actually used.")
.arg(Arg::with_name("INPUT") .arg(Arg::with_name("INPUT")
.help("Specify thinp metadata binary device/file") .help("Specify thinp metadata binary device/file")

View File

@ -10,7 +10,7 @@ use std::process::exit;
fn main() { fn main() {
let parser = App::new("thin_metadata_unpack") 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.") .about("Unpack a compressed file of thin metadata.")
.arg( .arg(
Arg::with_name("INPUT") Arg::with_name("INPUT")

View File

@ -13,7 +13,7 @@ use thinp::thin::restore::{restore, ThinRestoreOptions};
fn main() { fn main() {
let parser = App::new("thin_restore") let parser = App::new("thin_restore")
.version(thinp::version::TOOLS_VERSION) .version(thinp::version::tools_version())
.about("Convert XML format metadata to binary.") .about("Convert XML format metadata to binary.")
.arg( .arg(
Arg::with_name("OVERRIDE_MAPPING_ROOT") Arg::with_name("OVERRIDE_MAPPING_ROOT")

View File

@ -12,7 +12,7 @@ use thinp::file_utils;
fn main() { fn main() {
let parser = App::new("thin_shrink") 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.") .about("Rewrite xml metadata and move data in an inactive pool.")
.arg( .arg(
Arg::with_name("INPUT") Arg::with_name("INPUT")

View File

@ -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()
}

View File

@ -1,6 +1,6 @@
use anyhow::Result; use anyhow::Result;
use duct::cmd; use duct::cmd;
use thinp::version::TOOLS_VERSION; use thinp::version::tools_version;
mod common; mod common;
@ -12,14 +12,14 @@ use common::*;
#[test] #[test]
fn accepts_v() -> Result<()> { fn accepts_v() -> Result<()> {
let stdout = cache_check!("-V").read()?; let stdout = cache_check!("-V").read()?;
assert_eq!(stdout, TOOLS_VERSION); assert_eq!(stdout, tools_version());
Ok(()) Ok(())
} }
#[test] #[test]
fn accepts_version() -> Result<()> { fn accepts_version() -> Result<()> {
let stdout = cache_check!("--version").read()?; let stdout = cache_check!("--version").read()?;
assert_eq!(stdout, TOOLS_VERSION); assert_eq!(stdout, tools_version());
Ok(()) Ok(())
} }

View File

@ -1,6 +1,6 @@
use anyhow::Result; use anyhow::Result;
use thinp::file_utils; use thinp::file_utils;
use thinp::version::TOOLS_VERSION; use thinp::version::tools_version;
mod common; mod common;
@ -13,14 +13,14 @@ use common::*;
#[test] #[test]
fn accepts_v() -> Result<()> { fn accepts_v() -> Result<()> {
let stdout = thin_check!("-V").read()?; let stdout = thin_check!("-V").read()?;
assert_eq!(stdout, TOOLS_VERSION); assert_eq!(stdout, tools_version());
Ok(()) Ok(())
} }
#[test] #[test]
fn accepts_version() -> Result<()> { fn accepts_version() -> Result<()> {
let stdout = thin_check!("--version").read()?; let stdout = thin_check!("--version").read()?;
assert_eq!(stdout, TOOLS_VERSION); assert_eq!(stdout, tools_version());
Ok(()) Ok(())
} }

View File

@ -1,5 +1,5 @@
use anyhow::Result; use anyhow::Result;
use thinp::version::TOOLS_VERSION; use thinp::version::tools_version;
mod common; mod common;
use common::test_dir::*; use common::test_dir::*;
@ -10,14 +10,14 @@ use common::*;
#[test] #[test]
fn accepts_v() -> Result<()> { fn accepts_v() -> Result<()> {
let stdout = thin_delta!("-V").read()?; let stdout = thin_delta!("-V").read()?;
assert_eq!(stdout, TOOLS_VERSION); assert_eq!(stdout, tools_version());
Ok(()) Ok(())
} }
#[test] #[test]
fn accepts_version() -> Result<()> { fn accepts_version() -> Result<()> {
let stdout = thin_delta!("--version").read()?; let stdout = thin_delta!("--version").read()?;
assert_eq!(stdout, TOOLS_VERSION); assert_eq!(stdout, tools_version());
Ok(()) Ok(())
} }

View File

@ -1,5 +1,5 @@
use anyhow::Result; use anyhow::Result;
use thinp::version::TOOLS_VERSION; use thinp::version::tools_version;
mod common; mod common;
use common::test_dir::*; use common::test_dir::*;
@ -10,14 +10,14 @@ use common::*;
#[test] #[test]
fn accepts_v() -> Result<()> { fn accepts_v() -> Result<()> {
let stdout = thin_metadata_pack!("-V").read()?; let stdout = thin_metadata_pack!("-V").read()?;
assert!(stdout.contains(TOOLS_VERSION)); assert!(stdout.contains(tools_version()));
Ok(()) Ok(())
} }
#[test] #[test]
fn accepts_version() -> Result<()> { fn accepts_version() -> Result<()> {
let stdout = thin_metadata_pack!("--version").read()?; let stdout = thin_metadata_pack!("--version").read()?;
assert!(stdout.contains(TOOLS_VERSION)); assert!(stdout.contains(tools_version()));
Ok(()) Ok(())
} }

View File

@ -1,5 +1,5 @@
use anyhow::Result; use anyhow::Result;
use thinp::version::TOOLS_VERSION; use thinp::version::tools_version;
mod common; mod common;
use common::test_dir::*; use common::test_dir::*;
@ -10,14 +10,14 @@ use common::*;
#[test] #[test]
fn accepts_v() -> Result<()> { fn accepts_v() -> Result<()> {
let stdout = thin_metadata_unpack!("-V").read()?; let stdout = thin_metadata_unpack!("-V").read()?;
assert!(stdout.contains(TOOLS_VERSION)); assert!(stdout.contains(tools_version()));
Ok(()) Ok(())
} }
#[test] #[test]
fn accepts_version() -> Result<()> { fn accepts_version() -> Result<()> {
let stdout = thin_metadata_unpack!("--version").read()?; let stdout = thin_metadata_unpack!("--version").read()?;
assert!(stdout.contains(TOOLS_VERSION)); assert!(stdout.contains(tools_version()));
Ok(()) Ok(())
} }

View File

@ -1,6 +1,6 @@
use anyhow::Result; use anyhow::Result;
use std::str::from_utf8; use std::str::from_utf8;
use thinp::version::TOOLS_VERSION; use thinp::version::tools_version;
mod common; mod common;
use common::test_dir::*; use common::test_dir::*;
@ -11,14 +11,14 @@ use common::*;
#[test] #[test]
fn accepts_v() -> Result<()> { fn accepts_v() -> Result<()> {
let stdout = thin_repair!("-V").read()?; let stdout = thin_repair!("-V").read()?;
assert_eq!(stdout, TOOLS_VERSION); assert_eq!(stdout, tools_version());
Ok(()) Ok(())
} }
#[test] #[test]
fn accepts_version() -> Result<()> { fn accepts_version() -> Result<()> {
let stdout = thin_repair!("--version").read()?; let stdout = thin_repair!("--version").read()?;
assert_eq!(stdout, TOOLS_VERSION); assert_eq!(stdout, tools_version());
Ok(()) Ok(())
} }

View File

@ -1,7 +1,7 @@
use anyhow::Result; use anyhow::Result;
use std::str::from_utf8; use std::str::from_utf8;
use thinp::file_utils; use thinp::file_utils;
use thinp::version::TOOLS_VERSION; use thinp::version::tools_version;
mod common; mod common;
use common::test_dir::*; use common::test_dir::*;
@ -12,14 +12,14 @@ use common::*;
#[test] #[test]
fn accepts_v() -> Result<()> { fn accepts_v() -> Result<()> {
let stdout = thin_restore!("-V").read()?; let stdout = thin_restore!("-V").read()?;
assert_eq!(stdout, TOOLS_VERSION); assert_eq!(stdout, tools_version());
Ok(()) Ok(())
} }
#[test] #[test]
fn accepts_version() -> Result<()> { fn accepts_version() -> Result<()> {
let stdout = thin_restore!("--version").read()?; let stdout = thin_restore!("--version").read()?;
assert_eq!(stdout, TOOLS_VERSION); assert_eq!(stdout, tools_version());
Ok(()) Ok(())
} }

View File

@ -1,5 +1,5 @@
use anyhow::Result; use anyhow::Result;
use thinp::version::TOOLS_VERSION; use thinp::version::tools_version;
mod common; mod common;
use common::test_dir::*; use common::test_dir::*;
@ -10,14 +10,14 @@ use common::*;
#[test] #[test]
fn accepts_v() -> Result<()> { fn accepts_v() -> Result<()> {
let stdout = thin_rmap!("-V").read()?; let stdout = thin_rmap!("-V").read()?;
assert_eq!(stdout, TOOLS_VERSION); assert_eq!(stdout, tools_version());
Ok(()) Ok(())
} }
#[test] #[test]
fn accepts_version() -> Result<()> { fn accepts_version() -> Result<()> {
let stdout = thin_rmap!("--version").read()?; let stdout = thin_rmap!("--version").read()?;
assert_eq!(stdout, TOOLS_VERSION); assert_eq!(stdout, tools_version());
Ok(()) Ok(())
} }