mirror of
https://github.com/pcvolkmer/osc-variant.git
synced 2025-04-19 19:56:50 +00:00
refactor: Cleanup command handling
This commit is contained in:
parent
0ec9c85e3a
commit
bf5a3a697f
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* MIT License
|
* MIT License
|
||||||
*
|
*
|
||||||
* Copyright (c) 2023 Comprehensive Cancer Center Mainfranken
|
* Copyright (c) 2024 Comprehensive Cancer Center Mainfranken
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
@ -248,24 +248,22 @@ pub fn handle(command: SubCommand) -> Result<(), Box<dyn Error>> {
|
|||||||
|
|
||||||
data_a.print_diff(data_b, strict);
|
data_a.print_diff(data_b, strict);
|
||||||
}
|
}
|
||||||
SubCommand::Sha256Sum { inputfile } => {
|
SubCommand::Sha256Sum { inputfile } => match fs::read_to_string(inputfile.clone()) {
|
||||||
match fs::read_to_string(inputfile.clone()) {
|
Ok(content) => {
|
||||||
Ok(content) => {
|
println!(
|
||||||
println!(
|
"{} {}",
|
||||||
"{} {}",
|
digest(content).as_str(),
|
||||||
digest(content).as_str(),
|
PathBuf::from(inputfile.clone())
|
||||||
PathBuf::from(inputfile.clone())
|
.canonicalize()
|
||||||
.canonicalize()
|
.unwrap_or_default()
|
||||||
.unwrap_or_default()
|
.to_str()
|
||||||
.to_str()
|
.unwrap_or_default()
|
||||||
.unwrap_or_default()
|
)
|
||||||
)
|
}
|
||||||
}
|
Err(err) => {
|
||||||
Err(err) => {
|
eprintln!("{}", FileError::Reading(inputfile, err.to_string()));
|
||||||
eprintln!("{}", FileError::Reading(inputfile, err.to_string()));
|
}
|
||||||
}
|
},
|
||||||
};
|
|
||||||
}
|
|
||||||
SubCommand::Check {
|
SubCommand::Check {
|
||||||
file,
|
file,
|
||||||
list,
|
list,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user