This repository was archived by the owner on Apr 25, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-14
lines changed
Expand file tree Collapse file tree 2 files changed +11
-14
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,9 @@ def run(self, code_file):
1111 try :
1212 check_call (["bash" , "-c" , 'which -s python3' ])
1313 except Exception :
14- py_str = "python3"
15- else :
1614 py_str = "python"
15+ else :
16+ py_str = "python3"
1717 exit (run ([py_str , code_file ]).returncode )
1818
1919 def build (self , code , directory = None ):
@@ -29,7 +29,7 @@ def run(self, code_file):
2929 try :
3030 check_call (["bash" , "-c" , 'which -s python2' ])
3131 except Exception :
32- py_str = "python2"
33- else :
3432 py_str = "python"
33+ else :
34+ py_str = "python2"
3535 exit (run ([py_str , code_file ]).returncode )
Original file line number Diff line number Diff line change @@ -25,15 +25,13 @@ def main(args=None):
2525 )
2626 parser .add_argument (
2727 "--keep" ,
28- nargs = 1 ,
2928 type = pathlib .Path ,
3029 metavar = "DIRECTORY" ,
3130 default = None ,
3231 help = "Store the script in the given directory" ,
3332 )
3433 parser .add_argument (
3534 "--filename" ,
36- nargs = 1 ,
3735 help = "Give the stored file the speified name (does not do anything without --keep)" ,
3836 default = "script" ,
3937 )
@@ -58,14 +56,13 @@ def main(args=None):
5856 for key , value in parsed_dict .items ():
5957 if value :
6058 parser = handlers ["--" + key ]
61- break
62- code = sys .stdin .read ()
63- if ns .keep :
64- dir = ns .keep
65- os .makedirs (dir , exist_ok = True )
66- parser ().build (code , str (dir .joinpath (ns .filename )))
67- else :
68- parser ().build (code )
59+ code = sys .stdin .read ()
60+ if ns .keep :
61+ dir = ns .keep
62+ os .makedirs (dir , exist_ok = True )
63+ parser ().build (code , str (dir .joinpath (ns .filename )) + "." + key )
64+ else :
65+ parser ().build (code )
6966
7067
7168if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments