Add option '-f' for sync'ing only selected folders

This commit is contained in:
Riccardo Murri 2008-01-03 04:15:11 +01:00
parent 2985ddc61e
commit ec89c3eb53
3 changed files with 31 additions and 1 deletions

View File

@ -373,6 +373,15 @@ cd offlineimap-x.y.z</ProgramListing>
will debug the threading model.
</para></listitem>
</varlistentry>
<varlistentry><term>-f <replaceable>foldername</replaceable>[,<replaceable>foldername</replaceable>]</term>
<listitem><para> Only sync the specified folders. The
<replaceable>foldername</replaceable>s are the
untranslated foldernames. This command-line option
overrides any <property>folderfilter</property>
and <property>folderincludes</property> options in the
configuration file.
</para></listitem>
</varlistentry>
<varlistentry><term>-k [<replaceable>section</replaceable>:]<replaceable>option</replaceable>=<replaceable>value</replaceable>
</term>
<listitem><para> Override configuration file option. If

View File

@ -53,7 +53,7 @@ def startup(versionno):
sys.stdout.write(version.getcmdhelp() + "\n")
sys.exit(0)
for optlist in getopt(sys.argv[1:], 'P:1oqa:c:d:l:u:hk:')[0]:
for optlist in getopt(sys.argv[1:], 'P:1oqa:c:d:l:u:hk:f:')[0]:
options[optlist[0]] = optlist[1]
if options.has_key('-h'):
@ -115,6 +115,20 @@ def startup(versionno):
for section in accounts.getaccountlist(config):
config.set('Account ' + section, "quick", '-1')
if options.has_key('-f'):
foldernames = options['-f'].replace(" ", "").split(",")
folderfilter = "lambda f: f in %s" % foldernames
folderincludes = "[]"
for accountname in accounts.getaccountlist(config):
account_section = 'Account ' + accountname
remote_repo_section = 'Repository ' + \
config.get(account_section, 'remoterepository')
local_repo_section = 'Repository ' + \
config.get(account_section, 'localrepository')
for section in [remote_repo_section, local_repo_section]:
config.set(section, "folderfilter", folderfilter)
config.set(section, "folderincludes", folderincludes)
lock(config, ui)
try:

View File

@ -94,6 +94,13 @@ def getcmdhelp():
one else. The maildir option will enable debugging
for certain Maildir operations.
-f foldername[,foldername...]
Only sync the specified folders. The "foldername"s
are the *untranslated* foldernames. This
command-line option overrides any "folderfilter"
and "folderincludes" options in the configuration
file.
-k [section:]option=value
Override configuration file option. If"section" is
omitted, it defaults to "general". Any underscores