其他參數我要完成這樣的事情:參數依賴於與Argparse
-LoadFiles
-SourceFile "" -DestPath ""
-SourceFolder "" -DestPath ""
-GenericOperation
-SpecificOperation -Arga "" -Argb ""
-OtherOperation -Argc "" -Argb "" -Argc ""
用戶應該能夠運行的東西,如:
-LoadFiles -SourceFile「somePath」 -DestPath 「somePath」
或
-LoadFiles -SourceFolder 「somePath」 -DestPath 「somePath」
基本上,如果您有-LoadFiles,則需要在之後具有-SourceFile或-SourceFolder。如果您有-SourceFile,則需要具有-DestPath等。
此鏈條是否可以用於其他參數所需的參數?如果沒有,我至少可以做些什麼,如果你有-SourceFile,你必須有-DestPath?
http://bugs.python.org/issue11588探討增加一般相互依賴的測試方式,但直到被實現,最好的辦法是做自己的測試,解析後。 – hpaulj 2014-12-10 22:39:54