浏览代码

Rename "flag" to "onlygroups" to clarify its purpose

Mike Naberezny 11 年之前
父节点
当前提交
60d3d91f97
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      supervisor/supervisorctl.py

+ 4 - 4
supervisor/supervisorctl.py

@@ -223,7 +223,7 @@ class Controller(cmd.Cmd):
             raise
             raise
         return True
         return True
 
 
-    def completionmatches(self,text,line,flag=0):
+    def completionmatches(self, text, line, onlygroups=False):
         groups=[]
         groups=[]
         programs=[]
         programs=[]
         groupwiseprograms={}
         groupwiseprograms={}
@@ -241,8 +241,8 @@ class Controller(cmd.Cmd):
             else:
             else:
                 for n in groupwiseprograms[i]:
                 for n in groupwiseprograms[i]:
                     total.append(i+':'+n+' ')
                     total.append(i+':'+n+' ')
-        if flag:
-            # add/remove require only the group name
+        if onlygroups:
+            # add/remove/update require only the group name
             return [i+' ' for i in groups if i.startswith(text)]
             return [i+' ' for i in groups if i.startswith(text)]
         if len(line.split()) == 1:
         if len(line.split()) == 1:
             return total
             return total
@@ -287,7 +287,7 @@ class Controller(cmd.Cmd):
                 results=[i+' ' for i in self.vocab if i.startswith(text)]+[None]
                 results=[i+' ' for i in self.vocab if i.startswith(text)]+[None]
                 return results[state]
                 return results[state]
             elif exp in ['add','remove','update']:
             elif exp in ['add','remove','update']:
-                results=self.completionmatches(text,line,flag=1)+[None]
+                results=self.completionmatches(text,line,onlygroups=True)+[None]
                 return results[state]
                 return results[state]
             else:
             else:
                 results=[i+' ' for i in self.vocab if i.startswith(text)]+[None]
                 results=[i+' ' for i in self.vocab if i.startswith(text)]+[None]