Browse Source

added function test

Johann Woelper 10 years ago
parent
commit
99a5b6e383
1 changed files with 22 additions and 2 deletions
  1. 22 2
      pshell/pshell

+ 22 - 2
pshell/pshell

@@ -1,11 +1,31 @@
 import sys
 import os
 import readline
+import subprocess
 
+def vi():
+    subprocess.call('vi')
+
+possibles = globals().copy()
+possibles.update(locals())
 
 while True:
-    test = raw_input('$ ')
+    input_string = raw_input('$ ')
+    method = possibles.get(input_string)
+    if not method:
+        try:
+            
+            print subprocess.check_output(input_string)
+        except:
+            print "Method was not implemented, tryed built-in"
+            print 'Exec failed:', input_string
+        
+    else:
+        method()
+    
     try:
-        exec(test)
+        pass
+        #exec(test)
+        
     except:
         print 'Execution error'