[spp] [PATCH 06/12] spp: add file type support to compl_common

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


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

Add filtering to exclude directories for completion.

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

diff --git a/src/spp.py b/src/spp.py
index 0580066..46c1613 100755
--- a/src/spp.py
+++ b/src/spp.py
@@ -728,6 +728,12 @@ class Shell(cmd.Cmd, object):
                 for fn in res:
                     if fn[-1] == '/':
                         completions.append(fn)
+            elif ftype == 'file':
+                for fn in res:
+                    if fn[-1] != '/':
+                        completions.append(fn)
+            else:
+                completions = res
         else:
             completions = res
         return completions
-- 
2.13.1



More information about the spp mailing list