How to use the diazo.utils._createOptionParser function in diazo

To help you get started, we’ve selected a few diazo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github plone / diazo / lib / diazo / compiler.py View on Github external
def main():
    """Called from console script
    """
    parser = _createOptionParser(usage=usage)
    (options, args) = parser.parse_args()

    if options.rules is None:
        if len(args) == 2 and options.theme is None:
            options.rules, options.theme = args
        elif len(args) == 1:
            options.rules, = args
        else:
            parser.error('Wrong number of arguments.')
    elif args:
        parser.error('Wrong number of arguments.')

    if options.trace:
        logger.setLevel(logging.DEBUG)

    xsl_params = None
github plone / diazo / lib / diazo / run.py View on Github external
def main():
    """Called from console script
    """
    op = _createOptionParser(usage=usage)
    op.add_option(
        '-x',
        '--xsl',
        metavar='transform.xsl',
        help='XSL transform',
        dest='xsl',
        default=None,
    )
    op.add_option(
        '--path',
        metavar='PATH',
        help='URI path',
        dest='path',
        default=None,
    )
    op.add_option(
github plone / diazo / lib / diazo / rules.py View on Github external
def main():
    """Called from console script
    """
    parser = _createOptionParser(usage=usage)
    parser.add_option(
        '-s',
        '--stop',
        metavar='n',
        type='int',
        help='Stop preprocessing at stage n',
        dest='stop',
        default=None,
    )
    (options, args) = parser.parse_args()

    if options.rules is None:
        if len(args) == 2 and options.theme is None:
            options.rules, options.theme = args
        elif len(args) == 1:
            options.rules, = args