[spp] [PATCH 01/12] spp: add basic commands
ogawa.yasufumi at lab.ntt.co.jp
ogawa.yasufumi at lab.ntt.co.jp
Tue Mar 6 11:39:18 CET 2018
From: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
Add basic UNIX commands (cd, pwd, exit).
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
---
src/spp.py | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/spp.py b/src/spp.py
index 84f1fa7..e9df1a3 100755
--- a/src/spp.py
+++ b/src/spp.py
@@ -6,6 +6,7 @@ from __future__ import print_function
import argparse
import cmd
import json
+import os
from Queue import Empty
from Queue import Queue
import re
@@ -680,6 +681,16 @@ class Shell(cmd.Cmd, object):
self.recorded_file.close()
self.recorded_file = None
+ def do_pwd(self, args):
+ print(os.getcwd())
+
+ def do_cd(self, args):
+ if os.path.isdir(args):
+ os.chdir(args)
+ print(os.getcwd())
+ else:
+ print("No such a directory.")
+
def do_bye(self, arg):
"""Stop recording, close SPP, and exit: BYE"""
@@ -694,6 +705,11 @@ class Shell(cmd.Cmd, object):
self.close()
return True
+ def do_exit(self, args):
+ print('Thank you for using Soft Patch Panel')
+ self.close()
+ return True
+
def main(argv):
"""main"""
--
2.13.1
More information about the spp
mailing list