Skip to content
Snippets Groups Projects
Commit 52a6dd06 authored by michael.minelli's avatar michael.minelli
Browse files

Merge branch 'token_in_command_line_optionnal' into v2.2.0

parents f582a479 60b0aaa0
No related branches found
No related tags found
No related merge requests found
Pipeline #26548 passed
import chalk from 'chalk';
import CommanderCommand from '../../CommanderCommand';
import GitlabManager from '../../../managers/GitlabManager';
import inquirer from 'inquirer';
class SessionGitlabLoginCommand extends CommanderCommand {
......@@ -9,14 +10,23 @@ class SessionGitlabLoginCommand extends CommanderCommand {
protected defineCommand() {
this.command
.description('register the gitlab token')
.argument('<token>', 'personal access token from GitLab with api scope')
.option('-t, --token <string>', 'personal access token from GitLab with api scope')
.action(this.commandAction.bind(this));
}
protected async commandAction(token: string): Promise<void> {
protected async commandAction(options: any): Promise<void> {
if ( !options.token ) {
options.token = (await inquirer.prompt({
type : 'password',
name : 'token',
message: 'Please enter your gitlab token',
mask : ''
})).token;
}
console.log(chalk.cyan('Please wait while we are testing your Gitlab token...'));
GitlabManager.login(token);
GitlabManager.login(options.token);
await GitlabManager.testToken();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment