Explorar el Código

Remove unnecessary completion cases

Mike Naberezny hace 11 años
padre
commit
7a7cf6f444
Se han modificado 1 ficheros con 6 adiciones y 11 borrados
  1. 6 11
      supervisor/supervisorctl.py

+ 6 - 11
supervisor/supervisorctl.py

@@ -243,21 +243,16 @@ class Controller(cmd.Cmd):
                     total.append(i+':'+n+' ')
         if onlygroups:
             # add/remove/update require only the group name
-            return [i+' ' for i in groups if i.startswith(text)]
-        if len(line.split()) == 1:
-            return total
+            results = [i+' ' for i in groups if i.startswith(text)]
         else:
-            current=line.split()[-1]
-            if line.endswith(' ') and len(line.split()) > 1:
-                results=[i for i in total if i.startswith(text)]
-                return results
+            current = line.split()[-1]
             if ':' in current:
-                g=current.split(':')[0]
+                g = current.split(':')[0]
                 results = [i+' ' for i in groupwiseprograms[g]
                            if i.startswith(text)]
-                return results
-            results = [i for i in total if i.startswith(text)]
-            return results
+            else:
+                results = [i for i in total if i.startswith(text)]
+        return results
 
     def complete(self, text, state):
         try: