Mercurial > hg > smartopen
comparison smartopen/smartopen.py @ 4:01015b36290a
look for home configuration file if it exists
author | k0s <k0scist@gmail.com> |
---|---|
date | Sat, 21 Nov 2009 19:52:10 -0500 |
parents | 10fc4904c10f |
children | 4dd12cf64c0e |
comparison
equal
deleted
inserted
replaced
3:c5f19f51e1e8 | 4:01015b36290a |
---|---|
87 if not options.handlers: | 87 if not options.handlers: |
88 options.handlers = None | 88 options.handlers = None |
89 | 89 |
90 # config | 90 # config |
91 config = ConfigParser() | 91 config = ConfigParser() |
92 if options.config and os.path.exists(options.config): | 92 if not options.config: |
93 options.config = os.path.join(os.environ.get('HOME', ''), '.smartopen.ini') | |
94 if os.path.exists(options.config): | |
93 config.read(options.config) | 95 config.read(options.config) |
94 if not options.handlers and config.has_option('DEFAULTS', 'handlers'): | 96 if not options.handlers and config.has_option('DEFAULTS', 'handlers'): |
95 options.handlers = [ i.strip() for i in config.get('DEFAULTS', 'handlers').split(',') ] | 97 options.handlers = [ i.strip() for i in config.get('DEFAULTS', 'handlers').split(',') ] |
96 _config = {} | 98 _config = {} |
97 for section in config.sections(): | 99 for section in config.sections(): |