質問編集履歴
2
エラー条件の記載がなかった為。
test
CHANGED
File without changes
|
test
CHANGED
@@ -43,3 +43,23 @@
|
|
43
43
|
[パターン5]
|
44
44
|
|
45
45
|
test.py -d path -c count
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
上記の5パターン以外の引数の組み合わせではエラーとしたいです。
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
[エラーパターン例]
|
54
|
+
|
55
|
+
test.py -d path -f file1 ・・・「-d」と[-f」の同時指定によりエラー
|
56
|
+
|
57
|
+
test.py -c count ・・・「-c」の単独指定によりエラー
|
58
|
+
|
59
|
+
test.py file1 file2 -f file3 file4 ・・・オプション無しfileと[-f」の同時指定によりエラー
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
単純な引数排他ではparser.add_mutually_exclusive_groupを使用すればいいと思うのですが、
|
64
|
+
|
65
|
+
「-c」は「-d」とセットにするやり方が分かりませんでした。
|
1
コマンドライン引数の記載間違いを修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
test.py [-d path [-c count]|-f file...
|
15
|
+
test.py [-d path [-c count]|-f file...|file...]
|
16
16
|
|
17
17
|
|
18
18
|
|