Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to see duration in history output #684

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/travis/cli/history.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions spec/cli/history_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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