diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index c5adaef..38d398e 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -76,7 +76,8 @@ jobs: - { target: i686-pc-windows-msvc , os: windows-2019 } - { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } - { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } - - { target: x86_64-apple-darwin , os: macos-12 } + - { target: x86_64-apple-darwin , os: macos-13 } + - { target: aarch64-apple-darwin , os: macos-15 } - { target: x86_64-pc-windows-gnu , os: windows-2019 } - { target: x86_64-pc-windows-msvc , os: windows-2019 } - { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } diff --git a/CHANGELOG.md b/CHANGELOG.md index 82f624f..0524c5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,13 @@ -# unreleased +# unreleased ## Features * New `--print-color-table` option, see #229 (@sahinfalcon) +## Bugfixes + +- Throw an error when try to view a directory, see #234 (@Integral-Tech) + # v0.15.0 ## Features diff --git a/README.md b/README.md index b0b2ac3..937d295 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,10 @@ sudo snap install hexyl scoop install hexyl ``` +### Via [X-CMD](https://x-cmd.com) +``` +x env use hexyl +``` ## License diff --git a/src/main.rs b/src/main.rs index 9f6ca75..1b18d7d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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; @@ -247,7 +247,14 @@ fn run() -> Result<()> { let stdin = io::stdin(); let mut reader = match opt.file { - Some(filename) => Input::File(File::open(filename)?), + Some(filename) => { + if filename.is_dir() { + bail!("'{}' is a directory.", filename.to_string_lossy()); + } + let file = File::open(&filename)?; + + Input::File(file) + } None => Input::Stdin(stdin.lock()), };