Skip to content

Commit f6d61bb

Browse files
fix no current context (#294)
* fix no current context * update version
1 parent 1bc0c05 commit f6d61bb

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

lib/interface/cli/codefresh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ if (process.argv.includes('--get-yargs-completions')) {
5353
yargs.command(command.toCommand());
5454
});
5555
} catch (err) {
56-
printError(err);
56+
Output.printError(err);
5757
process.exit(1);
5858
}
5959
});

lib/interface/cli/helpers/general.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const wrapHandler = (handler, requiresAuthentication) => {
2626
}
2727

2828
if (process.env.NODE_ENV !== 'test') {
29-
const { url, token } = currentContext || {};
29+
const { url, token, type: contextType } = currentContext || {};
3030
const sdkConfig = {
3131
url,
3232
cache: {
@@ -38,9 +38,10 @@ const wrapHandler = (handler, requiresAuthentication) => {
3838
},
3939
};
4040

41-
// todo: move to openapi.json
42-
const tokenKey = currentContext.type === 'APIKey' ? 'apiKey' : 'accessToken';
43-
sdkConfig[tokenKey] = token;
41+
if (contextType) {
42+
const tokenKey = contextType === 'APIKey' ? 'apiKey' : 'accessToken';
43+
sdkConfig[tokenKey] = token;
44+
}
4445

4546
sdk.configure(sdkConfig);
4647
}

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.16.1",
3+
"version": "0.16.2",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)