add automatic detection of config_fragments

This commit is contained in:
Martin A. Brown 2016-02-25 09:58:11 -08:00
parent eb4e3d8c38
commit 92a9042a74
2 changed files with 7 additions and 8 deletions

2
TODO
View File

@ -14,5 +14,3 @@ CascadingConfig
---------------
* factor out CascadingConfig into its own project
* allow automatic detection of config_fragment() functions

View File

@ -4,6 +4,7 @@
from __future__ import absolute_import, division, print_function
import logging
import inspect
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.inventory import status_classes
import tldp.doctypes
import tldp.typeguesser
def collectconfiguration(tag, argv):
@ -48,12 +49,12 @@ def collectconfiguration(tag, argv):
default=None, type=arg_isreadablefile,
help='a configuration file')
# -- collect up the fragments of CLI; automate detection?
# -- collect up the distributed configuration fragments
#
tldp.doctypes.linuxdoc.config_fragment(ap)
tldp.doctypes.docbooksgml.config_fragment(ap)
tldp.doctypes.docbook4xml.config_fragment(ap)
tldp.doctypes.docbook5xml.config_fragment(ap)
for module in tldp.typeguesser.knowndoctypemodules:
config_fragment = getattr(module, 'config_fragment', None)
if config_fragment:
config_fragment(ap)
cc = CascadingConfig(tag, ap, argv)
config, args = cc.parse()