cctool

A tool for managing contacts and calendars.
git clone https://git.ce9e.org/cctool.git

commit
fade587e14f499c79eca0fcc4401db56afd218fa
parent
b721625df73d2a4f4f4021f747366455425409b8
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2014-04-21 00:51
mv available formats to separat function

Diffstat

M cctool.py 37 +++++++++++++++++++++----------------

1 files changed, 21 insertions, 16 deletions


diff --git a/cctool.py b/cctool.py

@@ -50,6 +50,26 @@ except ImportError as e:
   50    50 NOTSET = object()
   51    51 
   52    52 
   -1    53 def formats():
   -1    54 	informats = {
   -1    55 		'abook': ABook,
   -1    56 		'json': JSON,
   -1    57 	}
   -1    58 	outformats = {
   -1    59 		'bsdcal': BSDCal,
   -1    60 		'abook': ABook,
   -1    61 		'json': JSON,
   -1    62 	}
   -1    63 	if not isinstance(vobject, Exception):
   -1    64 		informats['ics'] = ICal
   -1    65 		outformats['ics'] = ICal
   -1    66 		informats['vcf'] = VCard
   -1    67 		outformats['vcf'] = VCard
   -1    68 	if not isinstance(ldif, Exception):
   -1    69 		informats['ldif'] = LDIF
   -1    70 	return informats, outformats
   -1    71 
   -1    72 
   53    73 class MultiDict(OrderedDict):
   54    74 	"""Dict subclass with multiple values for each key.
   55    75 
@@ -320,22 +340,7 @@ class JSON(Format):
  320   340 
  321   341 
  322   342 if __name__ == '__main__':
  323    -1 	informats = {
  324    -1 		'abook': ABook,
  325    -1 		'json': JSON,
  326    -1 	}
  327    -1 	outformats = {
  328    -1 		'bsdcal': BSDCal,
  329    -1 		'abook': ABook,
  330    -1 		'json': JSON,
  331    -1 	}
  332    -1 	if not isinstance(vobject, Exception):
  333    -1 		informats['ics'] = ICal
  334    -1 		outformats['ics'] = ICal
  335    -1 		informats['vcf'] = VCard
  336    -1 		outformats['vcf'] = VCard
  337    -1 	if not isinstance(ldif, Exception):
  338    -1 		informats['ldif'] = LDIF
   -1   343 	informats, outformats = formats()
  339   344 
  340   345 	parser = argparse.ArgumentParser(description=__doc__)
  341   346 	parser.add_argument('--from', '-f', choices=informats.keys(),