所以我有一个程序,我在python 3.5中使用argparse编写。现在我遇到了一个问题,我想在那里为任务指定标志。
wasp init -m
或
wasp tag -g
但我希望-g
不适用于init
,反之亦然
我目前只有init功能正常工作,但我不想添加-g
标志,直到我知道如何处理tag
来源在这里:
description = 'Generate and create basic resources for a modern web app. Initialize a project with a manifest, package, and tags versions effectively'
parser = argparse.ArgumentParser(description=description)
parser.add_argument('task', metavar='task', type=str, help='A task to perform. Options : init, update, tag')
parser.add_argument('-m', '--manifest', action='store_true', help='Generate a manifest.json for your project')
parser.add_argument('-p', '--package', action='store_true', help='Generate a package.json for your project')