3 # Author: A. S. Budden <abudden _at_ gmail _dot_ com>
4 # Copyright: Copyright (C) 2009-2011 A. S. Budden
5 # Permission is hereby granted to use and distribute this code,
6 # with or without modifications, provided that this copyright
7 # notice is copied with it. Like anything else that's free,
8 # the TagHighlight plugin is provided *as is* and comes with no
9 # warranty of any kind, either expressed or implied. By using
10 # this plugin, you agree that in no event will the copyright
11 # holder be liable for any damages resulting from the use
14 # ---------------------------------------------------------------------
15 from .config import config
17 from .loaddata import LoadDataFile
21 def LoadOptionSpecification():
22 ListKeys = ['CommandLineSwitches']
23 RequiredKeys = ['CommandLineSwitches', 'Type', 'Default', 'Help']
26 AllOptions = LoadDataFile('options.txt', ListKeys)
28 for dest in AllOptions.keys():
29 # Check we've got all of the required keys
30 for key in RequiredKeys:
31 if key not in AllOptions[dest]:
32 if 'VimOptionMap' in AllOptions[dest]:
33 # This is probably just a Vim option: ignore
36 raise Exception("Missing option {key} in option {dest}".format(key=key,dest=dest))
37 # Handle special types of options
38 if AllOptions[dest]['Type'] == 'bool':
39 if AllOptions[dest]['Default'] == 'True':
40 AllOptions[dest]['Default'] = True
42 AllOptions[dest]['Default'] = False
43 elif AllOptions[dest]['Type'] == 'list':
44 if AllOptions[dest]['Default'] == '[]':
45 AllOptions[dest]['Default'] = []
47 AllOptions[dest]['Default'] = AllOptions[dest]['Default'].split(',')
49 LoadOptionSpecification()