Skip to content

Commit

Permalink
Add a --raw flag to the show command
Browse files Browse the repository at this point in the history
This shows just the body of the note and allows the user to pipe the
output to another tool. Useful in combination with pandoc to create
LaTeX files from notes.
  • Loading branch information
martijn committed Jan 10, 2015
1 parent 4423092 commit 45d1056
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
6 changes: 6 additions & 0 deletions geeknote/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
"--note": {"altName": "-n",
"help": "The name or ID from the previous "
"search of a note to show."},
},
"flags": {
"--raw": {"altName": "-w",
"help": "Show the raw note body",
"value": True,
"default": False},
}
},
"find": {
Expand Down
7 changes: 5 additions & 2 deletions geeknote/geeknote.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ def remove(self, note, force=None):
else:
out.failureMessage("Error while deleting the note.")

def show(self, note):
def show(self, note, raw=None):

self.connectToEvertone()

Expand All @@ -634,7 +634,10 @@ def show(self, note):
out.preloader.setMessage("Loading note...")
self.getEvernote().loadNoteContent(note)

out.showNote(note)
if raw:
out.showNoteRaw(note)
else:
out.showNote(note)

def _parceInput(self, title=None, content=None, tags=None, notebook=None, note=None):
result = {
Expand Down
3 changes: 3 additions & 0 deletions geeknote/out.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,9 @@ def showNote(note):

printLine(Editor.ENMLtoText(note.content))

@preloaderStop
def showNoteRaw(note):
printLine(Editor.ENMLtoText(note.content, 'pre'))

@preloaderStop
def showUser(user, fullInfo):
Expand Down

0 comments on commit 45d1056

Please sign in to comment.