From ce66707667fe30338a218306ea9d6b92fe4066e2 Mon Sep 17 00:00:00 2001 From: khamidou Date: Mon, 8 Feb 2010 10:04:40 +0100 Subject: [PATCH] the show option now automatically calls less --- liszt | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/liszt b/liszt index 7276280..278e25f 100755 --- a/liszt +++ b/liszt @@ -6,6 +6,8 @@ from datetime import datetime import urllib, urllib2, cookielib from urllib import quote from urllib2 import HTTPError, URLError +import subprocess +from subprocess import Popen import fnmatch import tempfile @@ -24,6 +26,14 @@ conf.read(os.path.expanduser('~/.liszt/config')) username = conf.get('Credentials', 'username') password = conf.get('Credentials', 'password') +def help(): + print "liszt c|create listname ?entryname? " + print "liszt r[remove|d|delete listname ?entryindex?" + print "liszt s listname ?entryindex?" + print "liszt chk|check listname index" + print "liszt u|update listname index ?'new description'? ?'check'? ?'date'?" + + def bailout(msg): print msg sys.exit(-1) @@ -152,13 +162,6 @@ class CommandParser(object): if args[0] in self.dispatch: self.dispatch[args[0]](args[1:]) - def help(): - print "liszt c|create listname ?entryname? " - print "liszt r[remove|d|delete listname ?entryindex?" - print "liszt s listname ?entryindex?" - print "liszt chk|check listname index" - print "liszt~ m|mod|modify listname index ?'new description'? ?'check'? ?'date'?" - def parse_create(self, args): listname = "" entryname = "" @@ -187,7 +190,11 @@ class CommandParser(object): listname = "" entryname = "" + if sys.stdin.isatty(): + sys.stdin = os.popen('/bin/sh -c less -', 'w') + if len(args) == 0: + print "List of the created lists :" for list in session.get_lists_list(): print list @@ -253,6 +260,7 @@ class CommandParser(object): print dict session.update_list_entry(listname, i, dict) + os.unlink(filename) if __name__ == "__main__": -- 2.43.0