You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I wanted a script to search / list / display tomboy notes and found
your project. It was pretty much what I nedded, plus some neat creation /
edition features.
To have all the details I wanted, I made some work on your code. I'm
attaching a patch to the issue.
Here's a description of the modifications :
- use of "/usr/bin/env python" to suit more environments (where python is
not in /usr/bin but the "env" can tell us where it is)
- class initialization is done in an "__init__" (consctructor) method. In
the main() function, this means that the class instantiation is now "t =
Tommy(noteName, terms, starttdate, enddate)" (kind of) instead of setting
class attributes after instantiation.
- in findMostRecentNote : use of [1:] on allNotes to omit first element
(already processed by function)
- added a use case to the search method : the special note names "*" and
"-" define a search on all notes. so doing "python tommy.py -s - foo" would
search for "foo" in all notes.
- simplified the search method : iterates on notes' lines and searches for
words in arguments. displays the whole line instead of trunking it and
added the line number to the output.
- added colours to the search output. colours use terminal escape
sequences, so it's not the most portable code .. but special cases could be
done for each OS to define colours accordingly..
- turned things around in method displayNote, but the code is the same.
- removed the method argsToString. this is not expected.. to use spaces in
the title, enclose the title in quotes. remaining arguments are put in a
list in the class (and used to search).
- enclosed the call to main() in an if. this removes the bogus call to the
function upon inclusion of the file in some case. in fact it calls it only
when the file is called as the main program. this way, you can import the
file in the python interactive interpreter to do some debugging.
Hope some of those help you ;)
Original issue reported on code.google.com by [email protected] on 14 Sep 2009 at 6:37
Original issue reported on code.google.com by
[email protected]
on 14 Sep 2009 at 6:37Attachments:
The text was updated successfully, but these errors were encountered: