当前位置: 首页>>代码示例>>Python>>正文


Python Options.inputDir方法代码示例

本文整理汇总了Python中options.Options.inputDir方法的典型用法代码示例。如果您正苦于以下问题:Python Options.inputDir方法的具体用法?Python Options.inputDir怎么用?Python Options.inputDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在options.Options的用法示例。


在下文中一共展示了Options.inputDir方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from options import Options [as 别名]
# 或者: from options.Options import inputDir [as 别名]
def main(argv=None): # IGNORE:C0111
    '''Command line options.'''

    if argv is None:
        argv = sys.argv
    else:
        sys.argv.extend(argv)

    program_name = os.path.basename(sys.argv[0])
    program_version = "v%s" % __version__
    program_build_date = str(__updated__)
    program_version_message = '%%(prog)s %s (%s)' % (program_version, program_build_date)
    if __name__ == '__main__':
        program_shortdesc = __import__('__main__').__doc__.split("\n")[1]
    else:
        program_shortdesc = __doc__.split("\n")[1]
    program_license = '''%s

  Created by Ari Fogel on %s.
  Copyright 2016 Ari Fogel. All rights reserved.

  Licensed under the Apache License 2.0
  http://www.apache.org/licenses/LICENSE-2.0

  Distributed on an "AS IS" basis without warranties
  or conditions of any kind, either express or implied.

USAGE
''' % (program_shortdesc, str(__date__))

    try:
        # Setup argument parser
        parser = ArgumentParser(description=program_license, formatter_class=RawDescriptionHelpFormatter)
        parser.add_argument('-o', '--outputdir', dest='outputDir', default=None, help="path to output directory", metavar="path")
        #parser.add_argument("-r", "--recursive", dest="recurse", action="store_true", help="recurse into subfolders [default: %(default)s]")
        parser.add_argument("-v", "--verbose", dest="verbose", action="count", help="set verbosity level [default: %(default)s]")
        parser.add_argument("-d", "--debug", dest="debug", help="print debug messages", action='store_true')
        #parser.add_argument("-i", "--include", dest="include", help="only include paths matching this regex pattern. Note: exclude is given preference over include. [default: %(default)s]", metavar="RE" )
        #parser.add_argument("-e", "--exclude", dest="exclude", help="exclude paths matching this regex pattern. [default: %(default)s]", metavar="RE" )
        parser.add_argument('-V', '--version', action='version', version=program_version_message)
        parser.add_argument('-i', '--inputdir', dest="inputDir", help="path to directory with source question file(s)", default=None, metavar="path", required=True)

        # Process arguments
        args = parser.parse_args()

        inputDir = args.inputDir
        options = Options()
        options.debug = args.debug
        options.inputDir = inputDir
        options.verbose = args.verbose
        options.outputDir = args.outputDir

        questionsToHTML(inputDir, options)
        return 0
    except KeyboardInterrupt:
        ### handle keyboard interrupt ###
        return 0
    except BatfishException as e:
        raise BatfishException("error running questions_to_html", e), None, sys.exc_info()[2]
    except Exception, e:
        if DEBUG or TESTRUN:
            raise(e)
        indent = len(program_name) * " "
        sys.stderr.write(program_name + ": " + repr(e) + "\n")
        sys.stderr.write(indent + "  for help use --help")
        return 2
开发者ID:Network-verification,项目名称:batfish,代码行数:68,代码来源:__main__.py


注:本文中的options.Options.inputDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。