Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

Commit b405932

Browse files
committed
Added a option to show GUID of tag/notebook
1 parent e86ccae commit b405932

File tree

3 files changed

+38
-9
lines changed

3 files changed

+38
-9
lines changed

geeknote/argparser.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@
125125
"in results to Evernote web-version.",
126126
"value": True,
127127
"default": False},
128+
"--with-tags": {"altName": "-wt",
129+
"help": "Add tag list of each note "
130+
"in results.",
131+
"value": True,
132+
"default": False},
133+
"--with-notebook": {"altName": "-wn",
134+
"help": "Add notebook of each note "
135+
"in results.",
136+
"value": True,
137+
"default": False},
128138
"--exact-entry": {"altName": "-ee",
129139
"help": "Search for exact "
130140
"entry of the request.",
@@ -134,7 +144,7 @@
134144
"help": "Search by content, not by title.",
135145
"value": True,
136146
"default": False},
137-
"--guid": {"altName": "-gi",
147+
"--guid": {"altName": "-id",
138148
"help": "Replace ID with GUID "
139149
"of each note in results.",
140150
"value": True,
@@ -145,6 +155,13 @@
145155
# Notebooks
146156
"notebook-list": {
147157
"help": "Show the list of existing notebooks in your Evernote.",
158+
"flags": {
159+
"--guid": {"altName": "-id",
160+
"help": "Replace ID with GUID "
161+
"of each notebook in results.",
162+
"value": True,
163+
"default": False},
164+
}
148165
},
149166
"notebook-create": {
150167
"help": "Create new notebook.",
@@ -167,6 +184,13 @@
167184
# Tags
168185
"tag-list": {
169186
"help": "Show the list of existing tags in your Evernote.",
187+
"flags": {
188+
"--guid": {"altName": "-id",
189+
"help": "Replace ID with GUID "
190+
"of each note in results.",
191+
"value": True,
192+
"default": False},
193+
}
170194
},
171195
"tag-create": {
172196
"help": "Create new tag.",

geeknote/geeknote.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,9 @@ def settings(self, editor=None):
451451
class Tags(GeekNoteConnector):
452452
""" Work with auth Notebooks """
453453

454-
def list(self):
454+
def list(self, guid=None):
455455
result = self.getEvernote().findTags()
456-
out.printList(result)
456+
out.printList(result, showGUID=guid)
457457

458458
def create(self, title):
459459
self.connectToEvertone()
@@ -511,9 +511,9 @@ def _searchTag(self, tag):
511511
class Notebooks(GeekNoteConnector):
512512
""" Work with auth Notebooks """
513513

514-
def list(self):
514+
def list(self, guid=None):
515515
result = self.getEvernote().findNotebooks()
516-
out.printList(result)
516+
out.printList(result, showGUID=guid)
517517

518518
def create(self, title):
519519
self.connectToEvertone()
@@ -773,7 +773,8 @@ def _searchNote(self, note):
773773

774774
def find(self, search=None, tags=None, notebooks=None,
775775
date=None, exact_entry=None, content_search=None,
776-
with_url=None, count=None, guid=None):
776+
with_url=None, with_tags=None, with_notebook=None,
777+
count=None, guid=None):
777778

778779
request = self._createSearchRequest(search, tags, notebooks,
779780
date, exact_entry,
@@ -812,7 +813,8 @@ def find(self, search=None, tags=None, notebooks=None,
812813
for note in result.notes:
813814
self.getStorage().setNote(note)
814815

815-
out.SearchResult(result.notes, request, showUrl=with_url, showGUID=guid)
816+
out.SearchResult(result.notes, request, showUrl=with_url, showTags=with_tags,
817+
showNotebook=with_notebook, showGUID=guid)
816818

817819
def _createSearchRequest(self, search=None, tags=None,
818820
notebooks=None, date=None,

geeknote/out.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ def separator(symbol="", title=""):
226226

227227
@preloaderStop
228228
def printList(listItems, title="", showSelector=False,
229-
showByStep=20, showUrl=False, showGUID=False):
229+
showByStep=20, showUrl=False, showTags=False,
230+
showNotebook=False, showGUID=False):
230231

231232
if title:
232233
separator("=", title)
@@ -236,10 +237,12 @@ def printList(listItems, title="", showSelector=False,
236237
for key, item in enumerate(listItems):
237238
key += 1
238239

239-
printLine("%s : %s%s%s" % (
240+
printLine("%s : %s%s%s%s%s" % (
240241
item.guid if showGUID and hasattr(item, 'guid') else str(key).rjust(3, " "),
241242
printDate(item.created).ljust(18, " ") if hasattr(item, 'created') else '',
242243
item.title if hasattr(item, 'title') else item.name,
244+
"".join( map(lambda s:" #"+s, item.tagGuids) ) if showTags and hasattr(item, 'tagGuids') and item.tagGuids else '',
245+
" @"+item.notebookGuid if showNotebook and hasattr(item, 'notebookGuid') else '',
243246
" " + (">>> " + config.NOTE_URL % item.guid) if showUrl else '',))
244247

245248
if key % showByStep == 0 and key < total:

0 commit comments

Comments
 (0)