Chris Lamb wrote:

> The attached patch removes this randomness from the output

Updated patch attached - was missing a ")" due to mishandling the Git
staging area..


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      [email protected] / chris-lamb.co.uk
       `-
diff --git a/doit/cmd_completion.py b/doit/cmd_completion.py
index e960eef..53ccf88 100644
--- a/doit/cmd_completion.py
+++ b/doit/cmd_completion.py
@@ -101,7 +101,7 @@ class TabCompletion(DoitCmdBase):
             self.task_list, _ = self.loader.load_tasks(
                 self, opt_values, pos_args)
             tmpl_vars['pt_tasks'] = '"{0}"'.format(
-                ' '.join(t.name for t in self.task_list if not t.is_subtask))
+                ' '.join(sorted(t.name for t in self.task_list if not 
t.is_subtask)))
         else:
             tmpl_list_cmd = "$({0} list {1} --quiet 2>/dev/null)"
             tmpl_vars['pt_tasks'] = tmpl_list_cmd.format(pt_bin_name,
@@ -196,7 +196,7 @@ class TabCompletion(DoitCmdBase):
             for task in self.task_list:
                 if not task.is_subtask:
                     lines.append("'{0}: {1}'".format(task.name, task.doc))
-            template_vars['pt_tasks'] = '(\n{0}\n)'.format('\n'.join(lines))
+            template_vars['pt_tasks'] = 
'(\n{0}\n)'.format('\n'.join(sorted(lines)))
         else:
             tmp_tasks = Template(
                 '''("${(f)$($pt_bin_name list --template '{name}: 
{doc}')}")''')

Reply via email to