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

Run on particular note or tag #8

Open
mjknght opened this issue May 12, 2020 · 6 comments
Open

Run on particular note or tag #8

mjknght opened this issue May 12, 2020 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@mjknght
Copy link

mjknght commented May 12, 2020

This is great! A feature request for the particular: would it be possible to run the script just for a particular note or a particular tag? This comes to mind when thinking about how that might work.

@cglacet
Copy link
Owner

cglacet commented May 12, 2020

That would be pretty easy to limit the script to a given note if the user provides the note's UUID yes. For the tags I guess you mean restrict the script to operate on notes that include a given tag?

@mjknght
Copy link
Author

mjknght commented May 12, 2020

Yes, that’s what I meant. I’d find that useful for certain tags, at least. Thanks for considering it!

@cglacet
Copy link
Owner

cglacet commented May 12, 2020

I'll add these two options very soon as it will only take a few lines of code :).

@cglacet
Copy link
Owner

cglacet commented May 24, 2020

I've updated the code in the notes-whitelist branch so we can try it out.

Here is how it can be used.

If you want to try it out, you'll have to switch to the test branch in your local copy of this repository (the install script will always install the master branch):

# depending on where you installed it, this should be the default:
cd ~/.github/bear/back-references  
git fetch
git checkout -t remotes/origin/notes-whitelist

Then you can run the python script directly using the options I mentioned in the README, for example:

BEAR_NOTES_WHITELIST=some-note-ID,some-other-note-ID \
BEAR_TAGS_WHITELIST="tag1#tag two" \
BEAR_INCLUDE_SUBTAGS=true \
python insert_backreferences.py

Let me know if you have problems with this (it's very likely that the UUID filtering will work, not so certain about the tag selection).

Once again, I recommend to run this in test mode first, just in case.

@cglacet
Copy link
Owner

cglacet commented Sep 14, 2020

@mjknght I haven't been working on this project for a while, did you have the opportunity to test this feature?

@mjknght
Copy link
Author

mjknght commented Sep 30, 2020

Hi @cglacet – apologies for a late reply. I haven't had much luck with this I'm afraid. I have just tried again and still have the following when attempting to switch to the test branch and test things out:

Traceback (most recent call last):
  File "insert_backreferences.py", line 174, in <module>
    main_test()
  File "insert_backreferences.py", line 36, in main_test
    backreferences, _ = find_all_links(notes)
  File "insert_backreferences.py", line 101, in find_all_links_by_section
    for header, wiki_link in note.sections_outgoing_wiki_links:
  File "/Users/Mark/bear/bear_note.py", line 32, in sections_outgoing_wiki_links
    for link in bear_api.wiki_link(content):
  File "/Users/Mark/bear/bear_api.py", line 80, in wiki_link
    referenced_note = notes(title=link_title)[0]
  File "/Users/Mark/bear/bear_api.py", line 16, in notes
    result = conn.execute(sql_request)
sqlite3.OperationalError: near "s": syntax error

I'm not the most confident with such things, so it may be that I am making a simple mistake – any ideas?

Thanks in advance.

@cglacet cglacet self-assigned this Oct 30, 2020
@cglacet cglacet added the bug Something isn't working label Oct 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants