Skip to content

Commit f38ef8d

Browse files
Cr 3517 (#637)
* fix issue with alias in case of github * bump version * fix example
1 parent 66c6aae commit f38ef8d

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

lib/interface/cli/commands/team/synchronize.cmd.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const syncRoot = require('../root/synchronize.cmd');
44
const { sdk } = require('../../../../logic');
55
const cliConfigManager = require('../../../../logic/cli-config/Manager');
66
const Spinner = require('ora');
7+
const CFError = require('cf-errors');
78

89
const REQUEST_TIMEOUT = 2 * 60 * 1000;
910

@@ -40,19 +41,26 @@ const command = new Command({
4041
type: 'boolean',
4142
default: false,
4243
})
43-
.example('codefresh synchronize teams [client-name] -t [client-type] -tk [accessToken]', 'Synchronize team with group');
44+
.example('codefresh synchronize teams [client-name] -t [client-type] --tk [accessToken]', 'Synchronize team with group');
4445
},
4546
handler: async (argv) => {
47+
const clientType = _.isArray(argv['client-type']) ? _.head(argv['client-type']) : argv['client-type'];
48+
4649
const config = cliConfigManager.config();
4750
if (!_.isInteger(argv.requestTimeout) || config.request.timeout < REQUEST_TIMEOUT) {
4851
_.set(sdk, 'config.http.config.timeout', REQUEST_TIMEOUT);
4952
}
53+
54+
if (clientType === 'github' && !argv['access-token']) {
55+
throw new CFError('access-token should be provided in case if client-type is "github"');
56+
}
57+
5058
const spinner = Spinner().start('Synchronizing...');
5159
let result;
5260
try {
5361
result = await sdk.teams.synchronizeClientWithGroup({
5462
name: argv['client-name'],
55-
type: argv['client-type'],
63+
type: clientType,
5664
access_token: argv['access-token'],
5765
disableNotifications: argv['disable-notifications']
5866
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.75.7",
3+
"version": "0.75.8",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)