[spp] [PATCH 5/5] Add completion for bye command
ogawa.yasufumi at lab.ntt.co.jp
ogawa.yasufumi at lab.ntt.co.jp
Tue Jul 18 20:57:29 CEST 2017
From: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
---
src/spp.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/spp.py b/src/spp.py
index 0e9908a..68b3a3f 100755
--- a/src/spp.py
+++ b/src/spp.py
@@ -350,6 +350,7 @@ class Shell(cmd.Cmd):
PRI_CMDS = ['status', 'exit', 'clear']
SEC_CMDS = ['status', 'exit', 'forward', 'stop', 'add', 'patch', 'del']
SEC_SUBCMDS = ['vhost', 'ring']
+ BYE_CMDS = ['sec', 'all']
def complete_pri(self, text, line, begidx, endidx):
"""Completion for primary process commands"""
@@ -409,6 +410,18 @@ class Shell(cmd.Cmd):
print(len(cleaned_line.split()))
print(e)
+ def complete_bye(self, text, line, begidx, endidx):
+ """Completion for bye commands"""
+
+ if not text:
+ completions = self.BYE_CMDS[:]
+ else:
+ completions = [p
+ for p in self.BYE_CMDS
+ if p.startswith(text)
+ ]
+ return completions
+
def response(self, result, message):
"""Enqueue message from other than CLI"""
try:
--
2.13.1
More information about the spp
mailing list