diff --git a/vdirsyncer/cli/__init__.py b/vdirsyncer/cli/__init__.py index 02eb41b..a1a8191 100644 --- a/vdirsyncer/cli/__init__.py +++ b/vdirsyncer/cli/__init__.py @@ -125,13 +125,16 @@ def sync(ctx, collections, force_delete): from .tasks import prepare_pair, sync_collection for pair_name, collections in collections: - prepare_pair( + for collection, config in prepare_pair( pair_name=pair_name, collections=collections, config=ctx.config, - force_delete=force_delete, - callback=sync_collection, - ) + ): + sync_collection( + collection=collection, + general=config, + force_delete=force_delete, + ) @app.command() @@ -147,12 +150,12 @@ def metasync(ctx, collections): from .tasks import prepare_pair, metasync_collection for pair_name, collections in collections: - prepare_pair( + for collection, config in prepare_pair( pair_name=pair_name, collections=collections, config=ctx.config, - callback=metasync_collection, - ) + ): + metasync_collection(collection=collection, general=config) @app.command() diff --git a/vdirsyncer/cli/tasks.py b/vdirsyncer/cli/tasks.py index 24907db..3799dc1 100644 --- a/vdirsyncer/cli/tasks.py +++ b/vdirsyncer/cli/tasks.py @@ -15,7 +15,7 @@ from .utils import manage_sync_status from .utils import save_status -def prepare_pair(pair_name, collections, config, callback, **kwargs): +def prepare_pair(pair_name, collections, config): pair = config.get_pair(pair_name) all_collections = dict( @@ -34,7 +34,7 @@ def prepare_pair(pair_name, collections, config, callback, **kwargs): ) collection = CollectionConfig(pair, collection_name, config_a, config_b) - callback(collection=collection, general=config.general, **kwargs) + yield collection, config.general def sync_collection(collection, general, force_delete):