Пример #1
0
def _parser():
    parser = OptionParser(description='Generate HTML files from .html and '
                          '.js files. Any options not recognised are '
                          'assumed to be input files.',
                          usage="usage: %prog [options] <input files>",
                          formatter=TitledHelpFormatter())

    default_parser_options(parser)

    parser.add_option("-C",
                      "--code",
                      action="store",
                      dest="codefile",
                      help="release file to be called by the HTML. Does not "
                      "need to exist yet. (release and canvas modes only)")

    # Mode one of [ 'plugin', 'plugin-debug', 'canvas', 'canvas-debug' ]
    parser.add_option("-m",
                      "--mode",
                      action="store",
                      dest="mode",
                      default='plugin-debug',
                      help="build mode: canvas, canvas-debug, plugin, "
                      "plugin-debug (default)")

    parser.add_option("-D",
                      "--dump-default-template",
                      action="store_true",
                      dest="dump_default_template",
                      default=False,
                      help="output the default template to file")

    return parser
Пример #2
0
def _parser():
    parser = OptionParser(description='Convert a JavaScript file into a .tzjs'
                          ' or .canvas.js file. Any options not recognised are'
                          ' assumed to be input files.',
                          usage="usage: %prog [options] <input files>",
                          formatter=TitledHelpFormatter())

    default_parser_options(parser)

    # Mode one of [ 'plugin', 'canvas' ]
    parser.add_option("-m", "--mode", action="store", dest="mode",
                      default='plugin', help="build mode: canvas, "
                      "plugin(default)")

    parser.add_option("--ignore-input-extension", action="store_true",
                      dest="ignore_ext_check", default=False,
                      help="allow input files with an extension other than .js")

    # Compacting
    parser.add_option("-y", "--yui", action="store", dest="yui", default=None,
                      help="path to the YUI compressor, setting this enables "
                      "compacting with the YUI compressor")
    parser.add_option("-c", "--closure", action="store", dest="closure",
                      default=None, help="path to the Closure compiler, setting "
                      "this enables the compacting with the Closure compiler "
                      "(EXPERIMENTAL)")
    parser.add_option("-u", "--uglifyjs", action="store", dest="uglifyjs",
                      default=None, help="path to the UglifyJS application, "
                      "setting this enables the compacting with the UglifyJS "
                      "compiler. This option assumes node.js is executable "
                      "from the path.")
    parser.add_option("--uglify", action="store", dest="uglifyjs",
                      default=None, help="Deprecated - Please use --uglifyjs")

    # Strip-debug
    parser.add_option("--no-strip-debug", action="store_false",
                      dest="stripdebug", default=True,
                      help="don't remove calls to debug.* methods")
    parser.add_option("--strip-debug", action="store",
                      dest="stripdebugpath", default=None,
                      help="set the path to the strip-debug application")
    parser.add_option("--strip-namespace", action="append", default=[],
                      dest="stripnamespaces", help="add namespace to strip "
                      "(see strip-debug --namespace flag)")
    parser.add_option("--strip-var", action="append", dest="stripvars",
                      help="define a global bool var for static code stripping "
                      "(see strip-debug -D flag)", default=[])

    parser.add_option("--ignore-errors", action="store_true",
                      dest="ignoreerrors", default=False,
                      help="ignore any syntax errors found while parsing")

    # Line length
    parser.add_option("-l", "--line-break", action="store", type="int",
                      dest="length", default=1000, help="split line length")

    return parser
Пример #3
0
def _parser():
    parser = OptionParser(description='Generate HTML files from .html and '
                          '.js files. Any options not recognised are '
                          'assumed to be input files.',
                          usage="usage: %prog [options] <input files>",
                          formatter=TitledHelpFormatter())

    default_parser_options(parser)

    parser.add_option("-C", "--code", action="store", dest="codefile",
                      help="release file to be called by the HTML. Does not "
                      "need to exist yet. (release and canvas modes only)")

    # Mode one of [ 'plugin', 'plugin-debug', 'canvas', 'canvas-debug' ]
    parser.add_option("-m", "--mode", action="store", dest="mode",
                      default='plugin-debug',
                      help="build mode: canvas, canvas-debug, plugin, "
                      "plugin-debug (default)")

    parser.add_option("-D", "--dump-default-template", action="store_true",
                      dest="dump_default_template", default=False,
                      help="output the default template to file")

    return parser