mirror of https://github.com/tLDP/python-tldp
add automatic detection of config_fragments
This commit is contained in:
parent
eb4e3d8c38
commit
92a9042a74
2
TODO
2
TODO
|
@ -14,5 +14,3 @@ CascadingConfig
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
* factor out CascadingConfig into its own project
|
* factor out CascadingConfig into its own project
|
||||||
|
|
||||||
* allow automatic detection of config_fragment() functions
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import inspect
|
||||||
|
|
||||||
from tldp.utils import logger
|
from tldp.utils import logger
|
||||||
|
|
||||||
|
@ -11,7 +12,7 @@ from tldp.utils import arg_isdirectory, arg_isloglevel, arg_isreadablefile
|
||||||
from tldp.cascadingconfig import CascadingConfig, DefaultFreeArgumentParser
|
from tldp.cascadingconfig import CascadingConfig, DefaultFreeArgumentParser
|
||||||
from tldp.inventory import status_classes
|
from tldp.inventory import status_classes
|
||||||
|
|
||||||
import tldp.doctypes
|
import tldp.typeguesser
|
||||||
|
|
||||||
|
|
||||||
def collectconfiguration(tag, argv):
|
def collectconfiguration(tag, argv):
|
||||||
|
@ -48,12 +49,12 @@ def collectconfiguration(tag, argv):
|
||||||
default=None, type=arg_isreadablefile,
|
default=None, type=arg_isreadablefile,
|
||||||
help='a configuration file')
|
help='a configuration file')
|
||||||
|
|
||||||
# -- collect up the fragments of CLI; automate detection?
|
# -- collect up the distributed configuration fragments
|
||||||
#
|
#
|
||||||
tldp.doctypes.linuxdoc.config_fragment(ap)
|
for module in tldp.typeguesser.knowndoctypemodules:
|
||||||
tldp.doctypes.docbooksgml.config_fragment(ap)
|
config_fragment = getattr(module, 'config_fragment', None)
|
||||||
tldp.doctypes.docbook4xml.config_fragment(ap)
|
if config_fragment:
|
||||||
tldp.doctypes.docbook5xml.config_fragment(ap)
|
config_fragment(ap)
|
||||||
|
|
||||||
cc = CascadingConfig(tag, ap, argv)
|
cc = CascadingConfig(tag, ap, argv)
|
||||||
config, args = cc.parse()
|
config, args = cc.parse()
|
||||||
|
|
Loading…
Reference in New Issue