Skip to content

Commit d57bb98

Browse files
committed
Fixed bug reading files from CLI
1 parent 33469a6 commit d57bb98

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# CHANGELOG
22

3+
## 2024-09-27 - [0.1.1]
4+
5+
### Bug fixes
6+
7+
- Fixed bug reading files from CLI.
8+
39
## 2024-09-27 - 0.1.0
410

511
First beta release
12+
13+
[0.1.1]: https://github.com/mondeja/hledger-fmt/compare/v0.1.0...v0.1.1

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hledger-fmt"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition = "2021"
55
description = "An opinionated hledger's journal files formatter."
66
repository = "https://github.com/mondeja/hledger-fmt"

src/main.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,18 @@ fn main() {
6060
}
6161
} else {
6262
for file in &args.files {
63-
if std::path::PathBuf::from(&file).is_dir() {
63+
let pathbuf = std::path::PathBuf::from(&file);
64+
if pathbuf.is_dir() {
6465
gather_files_from_directory_and_subdirectories(file, &mut files);
6566
break;
67+
} else if pathbuf.is_file() {
68+
files.push(file.clone());
69+
} else if !pathbuf.exists() {
70+
eprintln!("Path {file} does not exist.");
71+
exitcode = 1;
72+
} else if pathbuf.is_symlink() {
73+
eprintln!("Path {file} is a symlink. Symbolic links are not supported.");
74+
exitcode = 1;
6675
}
6776
}
6877

0 commit comments

Comments
 (0)