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 __future__ import print_function
20 from .config import SetInitialOptions, LoadLanguages
21 from .options import AllOptions
23 def ProcessCommandLine():
24 parser = optparse.OptionParser()
26 for dest in AllOptions.keys():
27 if 'CommandLineSwitches' not in AllOptions[dest]:
30 if AllOptions[dest]['Type'] == 'bool':
31 if AllOptions[dest]['Default'] == True:
32 action = 'store_false'
35 parser.add_option(*AllOptions[dest]['CommandLineSwitches'],
37 default=AllOptions[dest]['Default'],
39 help=AllOptions[dest]['Help'])
41 optparse_type='string'
42 if AllOptions[dest]['Type'] in ['string', 'int']:
44 elif AllOptions[dest]['Type'] == 'list':
47 raise Exception('Unrecognised option type: ' + AllOptions[dest]['Type'])
48 parser.add_option(*AllOptions[dest]['CommandLineSwitches'],
50 default=AllOptions[dest]['Default'],
53 help=AllOptions[dest]['Help'])
55 options, remainder = parser.parse_args()