File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 33from argparse import ArgumentParser
44import subprocess
55
6- from softioc import __version__
6+ from . import __version__
77
88
99def main (args = None ):
1010 parser = ArgumentParser ()
1111 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 )
1314 parser .add_argument (
1415 "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+
1823 subprocess .Popen (cmd ).communicate ()
1924
2025
You can’t perform that action at this time.
0 commit comments