Skip to content

Commit 7fc3d60

Browse files
authored
Merge branch 'master' into print-colour-table
2 parents 2346e41 + 6e0bff2 commit 7fc3d60

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

.github/workflows/CICD.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ jobs:
7676
- { target: i686-pc-windows-msvc , os: windows-2019 }
7777
- { target: i686-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }
7878
- { target: i686-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
79-
- { target: x86_64-apple-darwin , os: macos-12 }
79+
- { target: x86_64-apple-darwin , os: macos-13 }
80+
- { target: aarch64-apple-darwin , os: macos-15 }
8081
- { target: x86_64-pc-windows-gnu , os: windows-2019 }
8182
- { target: x86_64-pc-windows-msvc , os: windows-2019 }
8283
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true }

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
# unreleased
1+
# unreleased
22

33
## Features
44

55
* New `--print-color-table` option, see #229 (@sahinfalcon)
66

7+
## Bugfixes
8+
9+
- Throw an error when try to view a directory, see #234 (@Integral-Tech)
10+
711
# v0.15.0
812

913
## Features

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ sudo snap install hexyl
189189
scoop install hexyl
190190
```
191191

192+
### Via [X-CMD](https://x-cmd.com)
193+
```
194+
x env use hexyl
195+
```
192196

193197
## License
194198

src/main.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::path::PathBuf;
66
use clap::builder::ArgPredicate;
77
use clap::{ArgAction, Parser, ValueEnum};
88

9-
use anyhow::{anyhow, Context, Result};
9+
use anyhow::{anyhow, bail, Context, Result};
1010

1111
use const_format::formatcp;
1212

@@ -247,7 +247,14 @@ fn run() -> Result<()> {
247247
let stdin = io::stdin();
248248

249249
let mut reader = match opt.file {
250-
Some(filename) => Input::File(File::open(filename)?),
250+
Some(filename) => {
251+
if filename.is_dir() {
252+
bail!("'{}' is a directory.", filename.to_string_lossy());
253+
}
254+
let file = File::open(&filename)?;
255+
256+
Input::File(file)
257+
}
251258
None => Input::Stdin(stdin.lock()),
252259
};
253260

0 commit comments

Comments
 (0)