File tree 1 file changed +40
-0
lines changed
1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ import subprocess , os
2
+ import readline
3
+ while True :
4
+ try :
5
+ currentDir = u"\u001b [33m" + os .getcwd () + " " + u"\u001b [0m"
6
+ commandToRun = input (currentDir ).split (" " )
7
+
8
+ if commandToRun [0 ] == "cd" :
9
+
10
+ if len (commandToRun ) > 2 :
11
+ os .chdir (" " .join (commandToRun [1 : len (commandToRun )])) # To The end
12
+ continue
13
+
14
+ os .chdir (commandToRun [1 ]) # to change directories
15
+ continue
16
+
17
+ exitCode = subprocess .run (commandToRun , check = True )
18
+
19
+ except subprocess .CalledProcessError as e :
20
+ for i in e :
21
+ if e == "\n " :
22
+ pass
23
+ else :
24
+ print (e )
25
+
26
+ except FileNotFoundError :
27
+ print ("Command Not found: This may be because you have a custom command or an alias" )
28
+ print ("NOTE: Custom Commands or aliases don't work here" )
29
+
30
+ except KeyboardInterrupt :
31
+ print ("" )
32
+ break
33
+
34
+ except EOFError :
35
+ print ("" )
36
+ break
37
+
38
+ except PermissionError :
39
+ pass
40
+ exit ()
You can’t perform that action at this time.
0 commit comments