/**
  * Registers a new GitLab instance
  * @return void
  */
 public function register()
 {
     $host = $this->command->ask('What is the url of your GitLab instance? (https://git.example.com)');
     $authenticationType = $this->command->choice('How would you like to authenticate with your GitLab?', ['Username/email and password', 'Private token', 'Both'], '2');
     if ($authenticationType == 'Username/email and password') {
         $this->loginQuestions();
     } elseif ($authenticationType == 'Private token') {
         $this->privateTokenQuestions();
     } else {
         $this->loginQuestions();
         $this->privateTokenQuestions();
     }
     $numberOfGitLabs = count($this->gitlabManager->getInstances());
     $gitlab = new GitLab($numberOfGitLabs + 1, $this->login, $this->password, $this->privateToken, $host);
     $this->gitlabManager->addInstance($gitlab);
 }
Example #2
0
 public function renderCommandField(Command $command)
 {
     while (true) {
         $input = $command->choice($this->getConsoleLabel(), $this->get('choices', []), $this->get('default', null));
         $validator = $this->getValidator($input);
         if ($validator->passes()) {
             return $input;
         } else {
             $command->error($validator->errors()->first());
         }
     }
 }
Example #3
0
 /**
  * @inheritDoc
  * @return string
  */
 public function choice($question, array $choices, $default = null, $attempts = null, $multiple = null)
 {
     return parent::choice($question, $choices, $default, $attempts, $multiple);
 }