From ca3a306eccc21e7df7e73610c209bb58ab8ff14b Mon Sep 17 00:00:00 2001 From: John Goerzen Date: Thu, 11 Jan 2007 10:15:06 +0100 Subject: [PATCH] --help shows available UIs now Thanks to Daniel Rall for the patch. fixes #5 --- offlineimap/ui/detector.py | 10 ++++++---- offlineimap/version.py | 9 ++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/offlineimap/ui/detector.py b/offlineimap/ui/detector.py index 908b9f8..a320d1e 100644 --- a/offlineimap/ui/detector.py +++ b/offlineimap/ui/detector.py @@ -19,13 +19,15 @@ import offlineimap.ui import sys +DEFAULT_UI_LIST = ('Tk.Blinkenlights', 'Tk.VerboseUI', + 'Curses.Blinkenlights', 'TTY.TTYUI', + 'Noninteractive.Basic', 'Noninteractive.Quiet') + def findUI(config, chosenUI=None): - uistrlist = ['Tk.Blinkenlights', 'Tk.VerboseUI', - 'Curses.Blinkenlights', 'TTY.TTYUI', - 'Noninteractive.Basic', 'Noninteractive.Quiet'] + uistrlist = list(DEFAULT_UI_LIST) namespace={} for ui in dir(offlineimap.ui): - if ui.startswith('_') or ui=='detector': + if ui.startswith('_') or ui in ('detector', 'UIBase'): continue namespace[ui]=getattr(offlineimap.ui, ui) diff --git a/offlineimap/version.py b/offlineimap/version.py index f45bbfd..eee6619 100644 --- a/offlineimap/version.py +++ b/offlineimap/version.py @@ -100,7 +100,10 @@ cmdhelp = """ configuration file. The UI specified with -u will be forced to be used, even if its isuable() method states that it cannot be. Use this option with - care. The pre-defined options are listed in the - USER INTERFACES section. - + care. The pre-defined options, described in the + USER INTERFACES section of the man page, are: """ +from offlineimap.ui import detector +import os +for ui in detector.DEFAULT_UI_LIST: + cmdhelp += " " + ui + os.linesep