Search for entries with no tags or stars with -not -starred and -not -tagged (#1663)

* Allow for `-not -starred` to search for unstarred entries

* Add `-tagged` and `-not -tagged` functionality
This commit is contained in:
Ciaran Concannon 2023-01-28 19:45:01 +00:00 committed by GitHub
parent 17c987c605
commit 7bd15d12ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 127 additions and 18 deletions

View file

@ -124,6 +124,50 @@ Feature: Searching in a journal
| basic_folder.yaml |
| basic_dayone.yaml |
Scenario: Searching for unstarred entries
Given we use the config "<config_file>"
And we use the password "test" if prompted
When we run "jrnl -not -starred"
Then we should get no error
And the output should contain "2 entries found"
Examples: configs
| config_file |
| basic_onefile.yaml |
| basic_folder.yaml |
| basic_dayone.yaml |
Scenario: Searching for tagged entries
Given we use the config "<config_file>"
And we use the password "test" if prompted
When we run "jrnl -tagged"
Then we should get no error
And the output should contain "3 entries found"
Examples: configs
| config_file |
| basic_onefile.yaml |
| basic_folder.yaml |
| basic_dayone.yaml |
Scenario: Searching for untagged entries
Given we use the config "empty_folder.yaml"
When we run "jrnl Tagged entry. This one has a @tag."
Then we should get no error
When we run "jrnl Untagged entry. This one has no tag."
Then we should get no error
When we run "jrnl -not -tagged"
Then we should get no error
And the output should contain "1 entry found"
And the output should contain "This one has no tag"
Examples: configs
| config_file |
| basic_onefile.yaml |
| basic_folder.yaml |
| basic_dayone.yaml |
Scenario Outline: Searching for dates
Given we use the config "<config_file>"
When we run "jrnl -on 2020-08-31 --short"

View file

@ -23,6 +23,8 @@ def expected_args(**kwargs):
"change_time": None,
"edit": False,
"end_date": None,
"exclude_starred": False,
"exclude_tagged": False,
"today_in_history": False,
"month": None,
"day": None,
@ -38,6 +40,7 @@ def expected_args(**kwargs):
"starred": False,
"start_date": None,
"strict": False,
"tagged": False,
"tags": False,
"text": [],
"config_override": [],