这是我第一次使用docopt,我正在努力为一个小的命令行程序进行args解析。在
'''Usage:
ovh_mails.py list [--ugly]
ovh_mails.py add (<address> [--pswd=<password>][--description=<description>] | --file <filename>)
ovh_mails.py remove (<address> | --file <filename>)
ovh_mails.py (-h | --help)
Arguments:
<password> Password to access the mailbox (if not provided it's random generated)
<filename> Name of the files to process. Check README to see how to format it
Options:
-h, --help Show this help message
-u, --ugly Print without nice tables
-p, --pswd=<password> Set the password to the one provided
Commands:
list list all the email addresses currently configured
add add one or more (configured in <filename>) email addresses
remove remove one ore more (configured in <filename>) email addresses'''
我现在的论点是:
^{pr2}$有没有更好的,更多的Python矿石更优雅的方式,这样做?在
您可以为每个命令编写验证函数,并将它们放入
validate
字典中:^{} recommends ^{} 用于数据验证。在
相关问题 更多 >
编程相关推荐