File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change
1
+ Raise error if --user and --target are used together in command
Original file line number Diff line number Diff line change @@ -83,6 +83,17 @@ def parse_command(args):
83
83
# the subcommand name
84
84
cmd_name = args_else [0 ]
85
85
86
+ validate_command_args (cmd_name , args_else )
87
+
88
+ # all the args without the subcommand
89
+ cmd_args = args [:]
90
+ cmd_args .remove (cmd_name )
91
+
92
+ return cmd_name , cmd_args
93
+
94
+
95
+ def validate_command_args (cmd_name , args_else ):
96
+ # type: (str, List[str]) -> None
86
97
if cmd_name not in commands_dict :
87
98
guess = get_similar_commands (cmd_name )
88
99
@@ -92,8 +103,6 @@ def parse_command(args):
92
103
93
104
raise CommandError (' - ' .join (msg ))
94
105
95
- # all the args without the subcommand
96
- cmd_args = args [:]
97
- cmd_args .remove (cmd_name )
98
-
99
- return cmd_name , cmd_args
106
+ if set (['--user' , '--target' ]).issubset (set (args_else )):
107
+ error_msg = '--user and --target cant not be used together.'
108
+ raise CommandError (error_msg )
You can’t perform that action at this time.
0 commit comments