-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheasy.py
More file actions
64 lines (51 loc) · 2.34 KB
/
Copy patheasy.py
File metadata and controls
64 lines (51 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import optparse , concurrent.futures , readline
from assets import CommandsParser , ScriptsRunner , CommandsPaths , Parser
from os import path
def Shell(Options):
Path = CommandsPaths.Main()
Commands = CommandsParser.Main(Path)
while (1):
Input = input("/> ")
try:
if "-" in Input:
Command = Input.split('-')[0].replace(' ' , '')
Arguments = Input.split('-')[1].replace(' ' , '')
Script = Commands[Command]
ScriptsRunner.Main(Script=Script , Input=Arguments)
else:
Script = Commands[Input]
ScriptsRunner.Main(Script=Script , Input="")
except Exception as e:
if "No module named" in str(e):
print("The Command Has Been Found But The Script Doesn't Exists.")
else:
print("Can't Recognize This Command: '{0}'".format(Input))
def OptionsCollector():
Parser = optparse.OptionParser()
Parser.add_option("-f" , "--file" , dest="file" , help="The File You Want To Tranlate.")
Parser.add_option("-m" , "--mode" , dest="mode" , help="The Compalier Mode.")
Parser.add_option("-o" , "--output" , dest="output" , help="The Compiled Output File")
Parser.add_option("--folder" , dest="folder" , help="Compile a Hall Folder That Contains Easy Code.")
Options,_ = Parser.parse_args()
return Options
def Validator(File , Mode , Output):
if File:
if Mode: pass
else: print("You Didn't Pick Up a Mode.\nModes: show, exec, execute, compile"); exit()
if not Output: Output = File.replace('.easy' , '.py')
else: pass
if path.exists(Options.file): Parser.Main(File=File , Mode=Mode , Output=Output); exit()
else: print(f"The File You Selected Doesn't Exists: {Options.file}"); exit()
else: pass
def Main(Options):
Validator(Options.file , Options.mode , Options.output)
try:
Shell(Options=Options)
except Exception as e:
print(str(e))
if __name__ == '__main__':
with concurrent.futures.ThreadPoolExecutor() as Collector:
Options = Collector.submit(OptionsCollector)
Options = Options.result()
with concurrent.futures.ThreadPoolExecutor() as Threader:
_ = Threader.submit(Main , Options)