diff --git a/lib/travis/cli/history.rb b/lib/travis/cli/history.rb index 643f3a07..58b4df55 100644 --- a/lib/travis/cli/history.rb +++ b/lib/travis/cli/history.rb @@ -10,6 +10,7 @@ class History < RepoCommand on('-b', '--branch BRANCH', 'Only show history for the given branch') on('-l', '--limit LIMIT', 'Maximum number of history items') on('-d', '--date', 'Include date in output') + on('-t', '--duration', 'Include build time in secs in output') on('-c', '--committer', 'Include committer in output') on('--[no-]all', 'Display all history items') @@ -39,6 +40,7 @@ def display(build) say [ date? && color(formatter.time(build.finished_at || build.started_at), build.color), color("##{build.number} #{build.state}:".ljust(16), [build.color, :bold]), + duration? && color(build.duration.to_s.ljust(6), :info), color("#{build.branch_info}", :info), committer? && build.commit.author_name.ljust(25), build.commit.subject diff --git a/spec/cli/history_spec.rb b/spec/cli/history_spec.rb index 9a4d4232..184fc53a 100644 --- a/spec/cli/history_spec.rb +++ b/spec/cli/history_spec.rb @@ -35,4 +35,9 @@ run_cli('history', '-c').should be_success stdout.should be == "#6180 failed: master Steve Klabnik Associaton -> Association\n" end + + example 'travis history -t' do + run_cli('history', '-t').should be_success + stdout.should be == "#6180 failed: 5019 master Associaton -> Association\n" + end end