refactor: simplify output format determination logic in main function
This commit is contained in:
@@ -50,11 +50,10 @@ fn main() -> Result<()> {
|
|||||||
let mut format = args.format;
|
let mut format = args.format;
|
||||||
if matches!(format, Format::Console) {
|
if matches!(format, Format::Console) {
|
||||||
if let Some(output_path) = &args.output {
|
if let Some(output_path) = &args.output {
|
||||||
if output_path.extension().and_then(|s| s.to_str()) == Some("md") {
|
match output_path.extension().and_then(|s| s.to_str()) {
|
||||||
format = Format::Markdown;
|
Some("md") => format = Format::Markdown,
|
||||||
}
|
Some("txt") => format = Format::Text,
|
||||||
if output_path.extension().and_then(|s| s.to_str()) == Some("txt") {
|
_ => {}
|
||||||
format = Format::Text;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user