Class: CircleCI::CLI::Command::BuildsCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/circleci/cli/command/builds_command.rb

Class Method Summary collapse

Methods inherited from BaseCommand

branch_name, build_number, project_name, setup_token

Class Method Details

.run(options) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/circleci/cli/command/builds_command.rb', line 8

def run(options)
  setup_token
  project_name = project_name(options)
  username, reponame = project_name.split('/')
  branch = branch_name(options)
  builds = if branch
             Response::Build.branch(username, reponame, branch)
           else
             Response::Build.all(username, reponame)
           end

  say Printer::BuildPrinter.new(builds, project_name, pretty: options.pretty).to_s
end