Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-and parameter seems to only work for the default journal #520

Closed
BAJ- opened this issue Jan 2, 2018 · 8 comments · Fixed by #991
Closed

-and parameter seems to only work for the default journal #520

BAJ- opened this issue Jan 2, 2018 · 8 comments · Fixed by #991
Labels
bug Something isn't working 📌 This can't go stale
Projects

Comments

@BAJ-
Copy link

BAJ- commented Jan 2, 2018

I have two journals setup like this:

{
  "journals": {
    "default": "~/log.txt",
    "work": "~/work.txt"
  }
}

If I want to view all entries with the tags @x and @y for the default log I write this:

jrnl -and @x @y

which nicely lists the correct entries. If I want to achieve the same for my work log I write this: jrnl work -and @x @y and this error gets thrown:

usage: jrnl [-h] [-v] [-ls] [-d] [-from DATE] [-until DATE] [-on DATE] [-and]
            [-starred] [-n [N]] [--short] [--tags] [--export TYPE] [-o OUTPUT]
            [--encrypt [FILENAME]] [--decrypt [FILENAME]] [--edit]
            [[...]]
jrnl: error: unrecognized arguments: @x @y

Am I misunderstanding how to use the -and parameter for non-default journals, or is this a bug?

@stelcodes
Copy link

Tested and got the same result. Seems like a bug. I think it's related to implementation of argparse module here.

@infomofo
Copy link

Running into the same issue. Is there a workaround- i.e. is there a syntax that anyone can recommend that will let me search my history easily?

@mysticmind
Copy link

@infomofo I have had success using jrnl work @tag1 @tag2 to filter non-default journal using tags

@codeitlikemiley
Copy link

codeitlikemiley commented Feb 9, 2019

@mysticmind what your saying is wrong,
Maybe you forgot that AND means the journal entry must contain those 2 tags
if not it should not display at all...

I can confirm im facing the same ISSUE as the OP...

i try to use jrnl tuts -n 5 -and @gpg @video

I have my journal use not the default one but the tuts journal...

I hope there can be a way to filter down by tags globally and by journal

without getting error...

@codeitlikemiley
Copy link

OK i think this will FIX the issue for the OP .. and mine...

This should be written in the DOCUMENTATION please...

the one that works for me was
jrnl tuts -n 5 @gpg @video -and
or
jrnl tuts -5 @gpg @video -and

The Docs Should Clearly Specify that if you are using Advance Set up or multiple jrnls then the -and should be declared LAST after your @tags ....

@stale stale bot added the stale label Jul 7, 2019
@jrnl-org jrnl-org deleted a comment from stale bot Jul 16, 2019
@wren
Copy link
Member

wren commented Jul 16, 2019

Confirmed the issue still exists in v2.0-rc2. This should be fixed, but the above can be a workaround for now.

@wren wren added bug Something isn't working and removed stale labels Jul 16, 2019
@wren wren added this to the v2.0.1 milestone Jul 16, 2019
@stale
Copy link

stale bot commented Sep 14, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Inactive issue: will be closed soon if no activity label Sep 14, 2019
@wren wren added the 📌 This can't go stale label Sep 17, 2019
@stale stale bot removed the stale Inactive issue: will be closed soon if no activity label Sep 17, 2019
@wren wren modified the milestones: v2.0.1, v2.0.2 Sep 21, 2019
@wren wren modified the milestones: v2.0.2, v2.1.2 - Non-critical bug fixes Oct 5, 2019
@dbxnr dbxnr mentioned this issue Jan 24, 2020
@wren wren removed this from the v2.1.2 milestone May 30, 2020
@micahellison
Copy link
Member

Trying to reproduce this issue, and I'm finding that it works if I put "-and" at the beginning or end of the argument list, but not anywhere else. Here I am searching a journal called "second":

C:\Users\micah>jrnl --version
jrnl version v2.4.2

C:\Users\micah>jrnl -and second @oldtag @newtag
2020-05-30 11:15:32 @oldtag @newtag here are all the tags


C:\Users\micah>jrnl second -and @oldtag @newtag
usage: jrnl [-h] [-v] [-ls] [-d] [-from DATE] [-until DATE]
            [-contains CONTAINS] [-on DATE] [-and] [-starred] [-n [N]]
            [-not E [E ...]] [-s] [--tags] [--export TYPE] [-o OUTPUT]
            [--import [TYPE]] [-i INPUT] [--encrypt [FILENAME]]
            [--decrypt [FILENAME]] [--edit] [--delete]
            [[...]]
jrnl: error: unrecognized arguments: @oldtag @newtag

C:\Users\micah>jrnl second @oldtag -and @newtag
usage: jrnl [-h] [-v] [-ls] [-d] [-from DATE] [-until DATE]
            [-contains CONTAINS] [-on DATE] [-and] [-starred] [-n [N]]
            [-not E [E ...]] [-s] [--tags] [--export TYPE] [-o OUTPUT]
            [--import [TYPE]] [-i INPUT] [--encrypt [FILENAME]]
            [--decrypt [FILENAME]] [--edit] [--delete]
            [[...]]
jrnl: error: unrecognized arguments: @newtag

C:\Users\micah>jrnl second @oldtag @newtag -and
2020-05-30 11:15:32 @oldtag @newtag here are all the tags

wren added a commit to wren/jrnl that referenced this issue Jul 1, 2020
Fixes jrnl-org#520 -and parameter seems to only work for the default journal
wren added a commit to wren/jrnl that referenced this issue Jul 2, 2020
Fixes jrnl-org#520 -and parameter seems to only work for the default journal
@wren wren added this to To do in Arg parsing Jul 2, 2020
@wren wren moved this from To do to Done in Arg parsing Jul 2, 2020
wren added a commit to wren/jrnl that referenced this issue Jul 26, 2020
Fixes jrnl-org#520 -and parameter seems to only work for the default journal
wren added a commit to wren/jrnl that referenced this issue Aug 1, 2020
Fixes jrnl-org#520 -and parameter seems to only work for the default journal
@wren wren closed this as completed in #991 Aug 1, 2020
wren added a commit that referenced this issue Aug 1, 2020
Fixes #520 -and parameter seems to only work for the default journal
wren added a commit that referenced this issue Oct 17, 2020
Fixes #520 -and parameter seems to only work for the default journal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 📌 This can't go stale
Projects
No open projects
Arg parsing
  
Done
Development

Successfully merging a pull request may close this issue.

7 participants