mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-26 20:16:31 +00:00
Minor updates
This commit is contained in:
1 parent
c65b298e60
commit
19198c2aac
1 file changed
+4
-4
+4
-4
@@ -6,7 +6,7 @@ use std::path::PathBuf;
|
||||
use clap::builder::ArgPredicate;
|
||||
use clap::{ArgAction, Parser, ValueEnum};
|
||||
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use anyhow::{anyhow, bail, Context, Result};
|
||||
|
||||
use const_format::formatcp;
|
||||
|
||||
@@ -235,10 +235,10 @@ fn run() -> Result<()> {
|
||||
|
||||
let mut reader = match opt.file {
|
||||
Some(filename) => {
|
||||
let file = File::open(&filename)?;
|
||||
if file.metadata()?.is_dir() {
|
||||
return Err(anyhow!("{} is a directory.", filename.display()));
|
||||
if filename.is_dir() {
|
||||
bail!("'{}' is a directory.", filename.to_string_lossy());
|
||||
}
|
||||
let file = File::open(&filename)?;
|
||||
|
||||
Input::File(file)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user