Skip to content

Commit ac888d3

Browse files
committed
Improve verbose output readability
1 parent 62b6642 commit ac888d3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/check/src/main.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::collections::HashSet;
22
use std::fs::File;
33
use std::io::Read;
4+
use std::path::Path;
45
use std::process::exit;
56

67
use clap::{Arg, ArgAction, Command};
@@ -104,7 +105,12 @@ fn check_contract(
104105
let mut wasm = Vec::<u8>::new();
105106
file.read_to_end(&mut wasm)?;
106107

107-
let prefix = format!("{}: ", path);
108+
// Potentially lossy filename or path as used as a short prefix for the output
109+
let filename_identifier: String = Path::new(path)
110+
.file_name()
111+
.map(|f| String::from_utf8_lossy(f.as_encoded_bytes()).to_string())
112+
.unwrap_or(path.to_string());
113+
let prefix = format!(" {}: ", filename_identifier);
108114
let logs = if verbose {
109115
Logger::On {
110116
prefix: &prefix,

0 commit comments

Comments
 (0)