Skip to content

Commit

Permalink
Fixed bug reading files from CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
mondeja committed Sep 27, 2024
1 parent 33469a6 commit d57bb98
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGELOG

## 2024-09-27 - [0.1.1]

### Bug fixes

- Fixed bug reading files from CLI.

## 2024-09-27 - 0.1.0

First beta release

[0.1.1]: https://github.com/mondeja/hledger-fmt/compare/v0.1.0...v0.1.1
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hledger-fmt"
version = "0.1.0"
version = "0.1.1"
edition = "2021"
description = "An opinionated hledger's journal files formatter."
repository = "https://github.com/mondeja/hledger-fmt"
Expand Down
11 changes: 10 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,18 @@ fn main() {
}
} else {
for file in &args.files {
if std::path::PathBuf::from(&file).is_dir() {
let pathbuf = std::path::PathBuf::from(&file);
if pathbuf.is_dir() {
gather_files_from_directory_and_subdirectories(file, &mut files);
break;
} else if pathbuf.is_file() {
files.push(file.clone());
} else if !pathbuf.exists() {
eprintln!("Path {file} does not exist.");
exitcode = 1;
} else if pathbuf.is_symlink() {
eprintln!("Path {file} is a symlink. Symbolic links are not supported.");
exitcode = 1;
}
}

Expand Down

0 comments on commit d57bb98

Please sign in to comment.