mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-27 21:16:14 +02:00
Only read text files that look like entries when opening folder journal (#1697)
* Add text file that should be ignored to basic test folder journal. Makes tons of tests fail * Add additional files that should be ignored by FolderJournal * Ignore all files in folder journal except year/month/day.txt * Completely remake get_files in FolderJournal: - move get_files into FolderJournal class and add underscore prefix - create iterables to get for year/month folders and day files - make year/month/day file reading strict: only exact expected months and days out of all possible months and days * Restore accidentally-deleted self.sort() line * Use match instead of string comparison to be os-agnostic * Explicitly declare static methods * Filter with glob first for max performance * Explicitly check for valid dates in FolderJournal and add unit test * Remove unneeded jrnl import * Clean up method comment and add type hints * Add is_valid_date unit test * Elucidate comment Co-authored-by: Jonathan Wren <jonathan@nowandwren.com>
This commit is contained in:
parent
88aa2491b0
commit
95836a7dd1
7 changed files with 153 additions and 16 deletions
|
@ -0,0 +1,4 @@
|
|||
[2022-03-02 9:25:00 AM] This file should be ignored (month)
|
||||
This text file is in a folder journal's month directory ("2020/09"), but it's not in the file name format used by jrnl for folder journal entries, so it should be ignored.
|
||||
|
||||
This file should not ever appear in a test.
|
|
@ -0,0 +1,4 @@
|
|||
[2022-03-02 9:25:00 AM] This file should be ignored (year)
|
||||
This text file is in a folder journal's year directory ("2020"), but it's not in the file name format used by jrnl for folder journal entries, so it should be ignored.
|
||||
|
||||
This file should not ever appear in a test.
|
4
tests/data/journals/basic_folder/should-be-ignored.txt
Normal file
4
tests/data/journals/basic_folder/should-be-ignored.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
[2022-03-02 9:25:00 AM] This file should be ignored (root)
|
||||
This text file is in a folder journal's root directory, but it's not in the file name format used by jrnl for folder journal entries, so it should be ignored.
|
||||
|
||||
This file should not ever appear in a test.
|
Loading…
Add table
Add a link
Reference in a new issue