This repository was archived by the owner on Apr 25, 2023. It is now read-only.
File tree 2 files changed +11
-14
lines changed
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):
11
11
try :
12
12
check_call (["bash" , "-c" , 'which -s python3' ])
13
13
except Exception :
14
- py_str = "python3"
15
- else :
16
14
py_str = "python"
15
+ else :
16
+ py_str = "python3"
17
17
exit (run ([py_str , code_file ]).returncode )
18
18
19
19
def build (self , code , directory = None ):
@@ -29,7 +29,7 @@ def run(self, code_file):
29
29
try :
30
30
check_call (["bash" , "-c" , 'which -s python2' ])
31
31
except Exception :
32
- py_str = "python2"
33
- else :
34
32
py_str = "python"
33
+ else :
34
+ py_str = "python2"
35
35
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):
25
25
)
26
26
parser .add_argument (
27
27
"--keep" ,
28
- nargs = 1 ,
29
28
type = pathlib .Path ,
30
29
metavar = "DIRECTORY" ,
31
30
default = None ,
32
31
help = "Store the script in the given directory" ,
33
32
)
34
33
parser .add_argument (
35
34
"--filename" ,
36
- nargs = 1 ,
37
35
help = "Give the stored file the speified name (does not do anything without --keep)" ,
38
36
default = "script" ,
39
37
)
@@ -58,14 +56,13 @@ def main(args=None):
58
56
for key , value in parsed_dict .items ():
59
57
if value :
60
58
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 )
69
66
70
67
71
68
if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments