Class: CircleCI::CLI::Command::BaseCommand

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

Class Method Summary collapse

Class Method Details

.branch_name(options) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/circleci/cli/command/base_command.rb', line 23

def branch_name(options)
  if options.all
    nil
  else
    options.branch
  end
end

.build_number(options) ⇒ Object



31
32
33
# File 'lib/circleci/cli/command/base_command.rb', line 31

def build_number(options)
  options.build || ask('Input build number')
end

.project_name(options) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/circleci/cli/command/base_command.rb', line 14

def project_name(options)
  if options.project
    options.project
  else
    say Printer::ProjectPrinter.new(Response::Project.all).to_s
    ask('Input user-name/project-name :')
  end
end

.setup_tokenObject



8
9
10
11
12
# File 'lib/circleci/cli/command/base_command.rb', line 8

def setup_token
  CircleCi.configure do |config|
    config.token = ENV.fetch('CIRCLE_CI_TOKEN', nil) || ask('Circle CI token ? :')
  end
end