From 798bcf384c753ae94c3c65bb96077805399f3993 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Sat, 3 May 2014 00:04:44 +0200 Subject: [PATCH] Move status name generation in own func --- vdirsyncer/cli.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vdirsyncer/cli.py b/vdirsyncer/cli.py index c1fb592..22704a8 100644 --- a/vdirsyncer/cli.py +++ b/vdirsyncer/cli.py @@ -32,6 +32,12 @@ cli_logger = log.get(__name__) PROJECT_HOME = 'https://github.com/untitaker/vdirsyncer' +def get_status_name(pair, collection): + if collection is None: + return pair + return pair + '/' + collection + + def load_config(fname, pair_options=('collections', 'conflict_resolution')): c = RawConfigParser() try: @@ -282,8 +288,7 @@ def _sync_collection(x): def sync_collection(config_a, config_b, pair_name, collection, pair_options, general, force_delete): - status_name = pair_name if collection is None \ - else '{}/{}'.format(pair_name, collection) + status_name = get_status_name(pair_name, collection) collection_description = pair_name if collection is None \ else '{} from {}'.format(collection, pair_name)