<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 == (unreleased)
 
+* Add -t (--tools) switch for better task lists for external tools [Jamis Buck]
+
 * Make the RemoteDependency#try method use invoke_command instead of run, for sudo-ability [Matthias Marschall]
 
 * Make locally executed commands in Windows more Windows-friendly [esad@esse.at]</diff>
      <filename>CHANGELOG.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -21,16 +21,18 @@ module Capistrano
       end
 
       def task_list(config, pattern = true) #:nodoc:
+        tool_output = options[:tool]
+
         if pattern.is_a?(String)
           tasks = config.task_list(:all).select {|t| t.fully_qualified_name =~ /#{pattern}/}
         end
         if tasks.nil? || tasks.length == 0
-          puts &quot;Pattern '#{pattern}' not found. Listing all tasks.\n\n&quot; unless pattern.is_a?(TrueClass)
+          warn &quot;Pattern '#{pattern}' not found. Listing all tasks.\n\n&quot; if !tool_output &amp;&amp; !pattern.is_a?(TrueClass)
           tasks = config.task_list(:all)
         end
 
         if tasks.empty?
-          warn &quot;There are no tasks available. Please specify a recipe file to load.&quot;
+          warn &quot;There are no tasks available. Please specify a recipe file to load.&quot; unless tool_output
         else
           all_tasks_length = tasks.length
           if options[:verbose].to_i &lt; 1
@@ -44,19 +46,25 @@ module Capistrano
           max_length = MIN_MAX_LEN if max_length &lt; MIN_MAX_LEN
 
           tasks.each do |task|
-            puts &quot;cap %-#{longest}s # %s&quot; % [task.fully_qualified_name, task.brief_description(max_length)]
+            if tool_output
+              puts &quot;cap #{task.fully_qualified_name}&quot;
+            else
+              puts &quot;cap %-#{longest}s # %s&quot; % [task.fully_qualified_name, task.brief_description(max_length)]
+            end
           end
 
-          if all_tasks_length &gt; tasks.length
+          unless tool_output
+            if all_tasks_length &gt; tasks.length
+              puts
+              puts &quot;Some tasks were not listed, either because they have no description,&quot;
+              puts &quot;or because they are only used internally by other tasks. To see all&quot;
+              puts &quot;tasks, type `#{File.basename($0)} -vT'.&quot;
+            end
+
             puts
-            puts &quot;Some tasks were not listed, either because they have no description,&quot;
-            puts &quot;or because they are only used internally by other tasks. To see all&quot;
-            puts &quot;tasks, type `#{File.basename($0)} -vT'.&quot;
+            puts &quot;Extended help may be available for these tasks.&quot;
+            puts &quot;Type `#{File.basename($0)} -e taskname' to view it.&quot;
           end
-
-          puts
-          puts &quot;Extended help may be available for these tasks.&quot;
-          puts &quot;Type `#{File.basename($0)} -e taskname' to view it.&quot;
         end
       end
 
@@ -107,4 +115,4 @@ module Capistrano
       end
     end
   end
-end
\ No newline at end of file
+end</diff>
      <filename>lib/capistrano/cli/help.rb</filename>
    </modified>
    <modified>
      <diff>@@ -46,6 +46,9 @@ The following options are understood:
   &lt;%= color '-T, --tasks PATTERN', :bold %&gt;
 	Displays the list of all tasks (matching optional PATTERN) in all loaded recipe files. If a task has no description, or if the description starts with the [internal] tag, the task will not be listed unless you also specify -v.
 
+  &lt;%= color '-t, --tool', :bold %&gt;
+	Abbreviates the output of -T for integration with other tools. Without -t, -T will list tasks with their summaries, and may include additional instructive text at the bottom. When integrating with other tools (e.g., bash auto-expansion and the like) that additional text can get in the way. This switch makes it easier for those tools to parse the list of tasks. (The -t switch has no effect if the -T switch is not specified.)
+
   &lt;%= color '-V, --version', :bold %&gt;
 	Shows the current Capistrano version number and exits.
 </diff>
      <filename>lib/capistrano/cli/help.txt</filename>
    </modified>
    <modified>
      <diff>@@ -90,6 +90,10 @@ module Capistrano
             options[:verbose] ||= 0
           end
 
+          opts.on(&quot;-t&quot;, &quot;--tool&quot;,
+            &quot;Abbreviates the output of -T for tool integration.&quot;
+          ) { options[:tool] = true }
+
           opts.on(&quot;-V&quot;, &quot;--version&quot;,
             &quot;Display the Capistrano version, and exit.&quot;
           ) do
@@ -100,7 +104,10 @@ module Capistrano
 
           opts.on(&quot;-v&quot;, &quot;--verbose&quot;,
             &quot;Be more verbose. May be given more than once.&quot;
-          ) { options[:verbose] ||= 0; options[:verbose] += 1 }
+          ) do
+            options[:verbose] ||= 0
+            options[:verbose] += 1
+          end
 
           opts.on(&quot;-X&quot;, &quot;--skip-system-config&quot;,
             &quot;Don't load the system config file (capistrano.conf)&quot;</diff>
      <filename>lib/capistrano/cli/options.rb</filename>
    </modified>
    <modified>
      <diff>@@ -84,6 +84,7 @@ class CLIHelpTest &lt; Test::Unit::TestCase
     config = mock(&quot;config&quot;)
     config.expects(:task_list).with(:all).times(2).returns(task_list)
 
+    @cli.stubs(:warn)
     @cli.stubs(:puts)
     @cli.task_list(config, &quot;z&quot;)
   end</diff>
      <filename>test/cli/help_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>9f4627b29c75d9f653ac6ec6e038e5bf103de837</id>
    </parent>
  </parents>
  <author>
    <name>Jamis Buck</name>
    <email>jamis@37signals.com</email>
  </author>
  <url>http://github.com/jamis/capistrano/commit/e53e1fbdc23b65f21e7a1fe6855d68594fa46548</url>
  <id>e53e1fbdc23b65f21e7a1fe6855d68594fa46548</id>
  <committed-date>2008-11-07T12:22:51-08:00</committed-date>
  <authored-date>2008-11-07T12:22:51-08:00</authored-date>
  <message>Add -t (--tools) switch for showing a tool-friendly task listing</message>
  <tree>2a78a32fe12c9807899a1e60aebabc096133a29b</tree>
  <committer>
    <name>Jamis Buck</name>
    <email>jamis@37signals.com</email>
  </committer>
</commit>
