git://git.onelab.eu
/
plcapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
ee0717f
)
evlauate api calls passed in as arguments to plcsh
author
Tony Mack
<tmack@cs.princeton.edu>
Fri, 25 Jan 2008 20:42:27 +0000
(20:42 +0000)
committer
Tony Mack
<tmack@cs.princeton.edu>
Fri, 25 Jan 2008 20:42:27 +0000
(20:42 +0000)
plcsh
patch
|
blob
|
history
diff --git
a/plcsh
b/plcsh
index
10944b0
..
e18c1d4
100755
(executable)
--- a/
plcsh
+++ b/
plcsh
@@
-59,11
+59,15
@@
except Exception, err:
parser.print_help()
sys.exit(1)
parser.print_help()
sys.exit(1)
-# If called by a script
-if len(sys.argv) > 1
and os.path.exists(sys.argv[1])
:
+# If called by a script
or api call is passed
+if len(sys.argv) > 1:
# Pop us off the argument stack
sys.argv.pop(0)
# Pop us off the argument stack
sys.argv.pop(0)
- execfile(sys.argv[0])
+ if os.path.exists(sys.argv[0]) and os.path.isfile(sys.argv[0]):
+ execfile(sys.argv[0])
+ else:
+ print eval(sys.argv[0])
+ sys.exit(0)
# Otherwise, run an interactive shell environment
else:
# Otherwise, run an interactive shell environment
else: