[spp] [PATCH 05/12] spp: fix bug of completion

ogawa.yasufumi at lab.ntt.co.jp ogawa.yasufumi at lab.ntt.co.jp
Tue Mar 6 11:39:22 CET 2018


From: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>

comple_common() returns file name if it matches a given keyword any of
position in the file, for instance, matches keyword 'bc' for file 'abc'.

This update fixes to match only started with keyword.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
---
 src/spp.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/spp.py b/src/spp.py
index e230b93..0580066 100755
--- a/src/spp.py
+++ b/src/spp.py
@@ -718,7 +718,7 @@ class Shell(cmd.Cmd, object):
 
             matched = []
             for t in os.listdir(target_dir):
-                if seg in t:
+                if t.find(seg) == 0:
                     matched.append(t)
             res = self.decorate_dir(target_dir, matched)
 
-- 
2.13.1



More information about the spp mailing list