Add command line option --dry-run
And set the [general]dry-run=True setting if yes. It is not used yet. Also set ui.dryrun to True so we can output what WE WOULD HAVE DONE in dryrun mode. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
parent
a8c6407f50
commit
b7e0a51751
@ -52,6 +52,13 @@ class OfflineImap:
|
|||||||
description="%s.\n\n%s" %
|
description="%s.\n\n%s" %
|
||||||
(offlineimap.__copyright__,
|
(offlineimap.__copyright__,
|
||||||
offlineimap.__license__))
|
offlineimap.__license__))
|
||||||
|
parser.add_option("--dry-run",
|
||||||
|
action="store_true", dest="dryrun",
|
||||||
|
default=False,
|
||||||
|
help="Do not actually modify any store but check and print "
|
||||||
|
"what synchronization actions would be taken if a sync would be"
|
||||||
|
" performed.")
|
||||||
|
|
||||||
parser.add_option("-1",
|
parser.add_option("-1",
|
||||||
action="store_true", dest="singlethreading",
|
action="store_true", dest="singlethreading",
|
||||||
default=False,
|
default=False,
|
||||||
@ -201,6 +208,12 @@ class OfflineImap:
|
|||||||
logging.warning('Using old interface name, consider using one '
|
logging.warning('Using old interface name, consider using one '
|
||||||
'of %s' % ', '.join(UI_LIST.keys()))
|
'of %s' % ', '.join(UI_LIST.keys()))
|
||||||
if options.diagnostics: ui_type = 'basic' # enforce basic UI for --info
|
if options.diagnostics: ui_type = 'basic' # enforce basic UI for --info
|
||||||
|
|
||||||
|
#dry-run? Set [general]dry-run=True
|
||||||
|
if options.dryrun:
|
||||||
|
dryrun = config.set('general','dry-run', "True")
|
||||||
|
config.set_if_not_exists('general','dry-run','False')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# create the ui class
|
# create the ui class
|
||||||
self.ui = UI_LIST[ui_type.lower()](config)
|
self.ui = UI_LIST[ui_type.lower()](config)
|
||||||
|
@ -48,6 +48,8 @@ def getglobalui():
|
|||||||
class UIBase(object):
|
class UIBase(object):
|
||||||
def __init__(self, config, loglevel = logging.INFO):
|
def __init__(self, config, loglevel = logging.INFO):
|
||||||
self.config = config
|
self.config = config
|
||||||
|
# Is this a 'dryrun'?
|
||||||
|
self.dryrun = config.getboolean('general', 'dry-run')
|
||||||
self.debuglist = []
|
self.debuglist = []
|
||||||
"""list of debugtypes we are supposed to log"""
|
"""list of debugtypes we are supposed to log"""
|
||||||
self.debugmessages = {}
|
self.debugmessages = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user