2016-02-22 20:34:26 +00:00
|
|
|
#! /usr/bin/python
|
|
|
|
# -*- coding: utf8 -*-
|
|
|
|
|
|
|
|
from __future__ import absolute_import, division, print_function
|
|
|
|
|
2016-02-23 01:10:45 +00:00
|
|
|
import logging
|
|
|
|
|
|
|
|
from tldp.utils import logger, isdirectory, isloglevel
|
2016-02-22 21:04:16 +00:00
|
|
|
from tldp.cascadingconfig import CascadingConfig, DefaultFreeArgumentParser
|
2016-02-22 20:34:26 +00:00
|
|
|
|
|
|
|
import tldp.doctypes
|
2016-02-23 16:44:05 +00:00
|
|
|
from tldp.inventory import status_classes
|
2016-02-22 20:34:26 +00:00
|
|
|
|
|
|
|
|
2016-02-23 05:21:24 +00:00
|
|
|
def collectconfiguration(tag, argv):
|
2016-02-23 16:59:37 +00:00
|
|
|
ap = DefaultFreeArgumentParser()
|
|
|
|
ap.add_argument('--build',
|
|
|
|
'-b',
|
|
|
|
action='store_true', default=False,
|
|
|
|
help='build LDP documentation [%(default)s]')
|
|
|
|
ap.add_argument('--detail', '--list',
|
|
|
|
'-l',
|
|
|
|
action='store_true', default=False,
|
|
|
|
help='list elements of LDP system [%(default)s]')
|
|
|
|
ap.add_argument('--status', '--summary',
|
|
|
|
'-t',
|
|
|
|
action='store_true', default=False,
|
|
|
|
help='dump inventory status report [%(default)s]')
|
|
|
|
ap.add_argument('--verbose',
|
|
|
|
action='store_true', default=False,
|
|
|
|
help='more info in --list and --status [%(default)s]')
|
|
|
|
ap.add_argument('--loglevel',
|
|
|
|
'-L',
|
|
|
|
default=logging.ERROR, type=isloglevel,
|
|
|
|
help='set the loglevel')
|
|
|
|
ap.add_argument('--sourcedir', '--source-dir', '--source-directory',
|
|
|
|
'-s',
|
|
|
|
action='append', default='', type=isdirectory,
|
|
|
|
help='a directory containing LDP source documents')
|
|
|
|
ap.add_argument('--pubdir', '--output', '--outputdir', '--outdir',
|
|
|
|
'-o',
|
|
|
|
default=None, type=isdirectory,
|
|
|
|
help='a directory containing LDP output documents')
|
|
|
|
ap.add_argument('--configfile', '--config-file', '--cfg',
|
|
|
|
'-c',
|
|
|
|
default=None, type=isdirectory,
|
|
|
|
help='a configuration file')
|
2016-02-22 20:34:26 +00:00
|
|
|
|
|
|
|
# -- collect up the fragments of CLI; automate detection?
|
|
|
|
#
|
2016-02-23 16:59:37 +00:00
|
|
|
tldp.doctypes.linuxdoc.config_fragment(ap)
|
|
|
|
tldp.doctypes.docbooksgml.config_fragment(ap)
|
|
|
|
tldp.doctypes.docbook4xml.config_fragment(ap)
|
|
|
|
tldp.doctypes.docbook5xml.config_fragment(ap)
|
2016-02-22 20:34:26 +00:00
|
|
|
|
2016-02-23 16:59:37 +00:00
|
|
|
cc = CascadingConfig(tag, ap, argv)
|
2016-02-23 00:19:05 +00:00
|
|
|
config, args = cc.parse()
|
2016-02-23 16:59:37 +00:00
|
|
|
return config, args
|
2016-02-22 20:34:26 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# -- end of file
|