paladin-plugins.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:paladin-plugins 作者: twestbrookunh 项目源码 文件源码
def parseArguments():
    argParser = argparse.ArgumentParser(description='PALADIN Pipeline Plugins')
    argParser.add_argument('-l', dest='list', action='store_true', help='List available plugins') 
    argParser.add_argument('plugins', metavar='Plugins', type=str, nargs=argparse.REMAINDER, help='Plugin with arguments (@@plugin arguments)')

    retArguments = argParser.parse_args()

    # Check for no arguments, or bad syntax in plugins list
    invalidArgs = False
    if not retArguments.list and not retArguments.plugins: invalidArgs = True
    if retArguments.plugins and not retArguments.plugins[0].startswith('@@'): invalidArgs = True

    if invalidArgs:
        argParser.print_help()
        sys.exit(1)

    # Replace quotes for strings with spaces
    for plugIdx in range(len(retArguments.plugins)):
        plugArg = retArguments.plugins[plugIdx]
        if ' ' in plugArg: plugArg = "\"{0}\"".format(plugArg)
        retArguments.plugins[plugIdx] = plugArg

    return retArguments

# Extract pipeline plugin/argument pairs from arguments
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号