* Removing a list
- list remove "my list"
- list remove "my list" entry_index
+ liszt remove "my list"
+ liszt remove "my list" entry_index
+
+* Adding entries in batch mode
+
+ liszt add "my list"
+
+ This will fire-up the text editor defined in the EDITOR environment variable. The file format is a bit peculiar : each entry is separated by a '+'
+ symbol. After adding the entries, save and quit. Liszt will automatically add the entries to your todoliszt.com list.
+
+* Updating the entries of a list
+
+ liszt update "my list"
+
+ Similarly to the 'add' option, update will open up a text editor with the content of the list "my list". The file format is similar to the one used with
+ the 'add' option : each entry begins with a + symbol. The contents of an entry are (in this order) : the text of an entry, a boolean indicating if it's
+ been done or not and a timestamp.
+ After saving and quitting, the list is automatically updated.
\ No newline at end of file
"show" : self.parse_show,
"s" : self.parse_show,
"update" : self.parse_update,
+ "add" : self.parse_add,
}
if args[0] in self.dispatch:
os.unlink(filename)
+ def parse_add(self, args):
+ listname = ""
+
+ if len(args) == 0:
+ bailout("liszt add listname ")
+
+ listname = args[0]
+
+ fd, filename = tempfile.mkstemp()
+
+ editor = os.getenv("EDITOR")
+ os.system(editor + " " + filename)
+ os.close(fd)
+
+ # Now, reopen the fd, as a python file handle.
+ fd = open(filename)
+ lines = fd.read().split('+')
+
+ for i in range(len(lines)):
+ # fields = lines[i].split("\t") FIXME: add support for different fields on a line.
+
+ if lines[i] != '':
+ session.create_list_entry(listname, lines[i].rstrip().lstrip())
+
+ os.unlink(filename)
+
if __name__ == "__main__":
if len(sys.argv) <= 1: