File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 9
9
def main (args = None ):
10
10
parser = ArgumentParser ()
11
11
parser .add_argument ("--version" , action = "version" , version = __version__ )
12
- parser .add_argument ("script" , help = "The python script to run" )
12
+ parser .add_argument (
13
+ "script" , help = "The python script to run" , nargs = "?" , default = None )
13
14
parser .add_argument (
14
15
"arg" , help = "Any arguments to pass to the script" , nargs = "*" )
15
- parsed_args = parser .parse_args (args )
16
- # Execute as subprocess
17
- cmd = [sys .executable , parsed_args .script ] + parsed_args .arg
16
+ parsed_args , unknown = parser .parse_known_args (args )
17
+
18
+ # Execute as subprocess.
19
+ cmd = [sys .executable ] + parsed_args .arg + unknown
20
+ if parsed_args .script :
21
+ cmd .insert (1 , parsed_args .script )
22
+
18
23
subprocess .Popen (cmd ).communicate ()
19
24
20
25
You can’t perform that action at this time.
0 commit comments