From 663e5ab1d0b5bd3c0512fe76e68707dc2c2ce009 Mon Sep 17 00:00:00 2001 From: "Amlesh Sivanantham (zamlz)" Date: Mon, 11 Mar 2019 13:25:15 -0700 Subject: [PATCH] Added events for tag updates --- pubs/commands/tag_cmd.py | 4 +++- pubs/events.py | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pubs/commands/tag_cmd.py b/pubs/commands/tag_cmd.py index 08f810a..da656b4 100644 --- a/pubs/commands/tag_cmd.py +++ b/pubs/commands/tag_cmd.py @@ -26,6 +26,7 @@ from .. import pretty from .. import color from ..utils import resolve_citekey from ..completion import CiteKeyOrTagCompletion, TagModifierCompletion +from ..events import TagEvent def parser(subparsers, conf): @@ -101,7 +102,8 @@ def command(conf, args): p.add_tag(tag) for tag in remove_tags: p.remove_tag(tag) - rp.push_paper(p, overwrite=True) + rp.push_paper(p, overwrite=True, event=False) + TagEvent(citekeyOrTag).send() elif tags is not None: ui.error(ui.error('No entry found for citekey {}.'.format(citekeyOrTag))) ui.exit() diff --git a/pubs/events.py b/pubs/events.py index a31c69e..62a4640 100644 --- a/pubs/events.py +++ b/pubs/events.py @@ -51,6 +51,10 @@ class RemoveEvent(PaperEvent): class DocRemoveEvent(PaperEvent): _format = "Removes document for {citekey}." +# Used by commands.tag_cmd.command() +class TagEvent(PaperEvent): + _format = "Updates tags for {citekey}." + # Used by commands.edit_cmd.command() class ModifyEvent(PaperEvent): _format = "Modifies {file_type} file of {citekey}." @@ -78,4 +82,4 @@ class RenameEvent(PaperEvent): # Used by commands.note_cmd.command() class NoteEvent(PaperEvent): - _format = "Modifies note {citekey}" + _format = "Modifies note {citekey}."