--help shows available UIs now

Thanks to Daniel Rall for the patch.
fixes #5
This commit is contained in:
John Goerzen 2007-01-11 10:15:06 +01:00
parent 71b82fb385
commit ca3a306ecc
2 changed files with 12 additions and 7 deletions

View File

@ -19,13 +19,15 @@
import offlineimap.ui import offlineimap.ui
import sys import sys
def findUI(config, chosenUI=None): DEFAULT_UI_LIST = ('Tk.Blinkenlights', 'Tk.VerboseUI',
uistrlist = ['Tk.Blinkenlights', 'Tk.VerboseUI',
'Curses.Blinkenlights', 'TTY.TTYUI', 'Curses.Blinkenlights', 'TTY.TTYUI',
'Noninteractive.Basic', 'Noninteractive.Quiet'] 'Noninteractive.Basic', 'Noninteractive.Quiet')
def findUI(config, chosenUI=None):
uistrlist = list(DEFAULT_UI_LIST)
namespace={} namespace={}
for ui in dir(offlineimap.ui): for ui in dir(offlineimap.ui):
if ui.startswith('_') or ui=='detector': if ui.startswith('_') or ui in ('detector', 'UIBase'):
continue continue
namespace[ui]=getattr(offlineimap.ui, ui) namespace[ui]=getattr(offlineimap.ui, ui)

View File

@ -100,7 +100,10 @@ cmdhelp = """
configuration file. The UI specified with -u will configuration file. The UI specified with -u will
be forced to be used, even if its isuable() method be forced to be used, even if its isuable() method
states that it cannot be. Use this option with states that it cannot be. Use this option with
care. The pre-defined options are listed in the care. The pre-defined options, described in the
USER INTERFACES section. 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