Skip to content

Commit bd97647

Browse files
authored
Merge pull request #285 from Cox-Automotive/print-log-format
Print log format
2 parents e152dbe + b79bfd5 commit bd97647

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

changelog.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
Thanks for upgrading to the latest version of the ALKS CLI!
55

6-
* Removes node-fetch/request usage that resulted in punycode deprecation warnings.
7-
# Removes dependency on alks-node.
6+
* Improves logging around output formats
87

98
Have feedback? https://github.com/Cox-Automotive/ALKS-CLI/issues
109

dist/changelog.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
Thanks for upgrading to the latest version of the ALKS CLI!
55

6-
* Removes node-fetch/request usage that resulted in punycode deprecation warnings.
7-
# Removes dependency on alks-node.
6+
* Improves logging around output formats
87

98
Have feedback? https://github.com/Cox-Automotive/ALKS-CLI/issues
109

dist/src/lib/getKeyOutput.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/src/lib/getKeyOutput.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/getKeyOutput.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import moment from 'moment';
33
import { Key } from '../model/keys';
44
import { isWindows } from './isWindows';
55
import { updateCreds } from './updateCreds';
6+
import { log } from './log';
67

78
// if adding new output types be sure to update getOutputValues.ts
89
export function getKeyOutput(
@@ -13,6 +14,8 @@ export function getKeyOutput(
1314
) {
1415
const keyExpires = moment(key.expires).format();
1516

17+
log(`using output format: ${format}`);
18+
1619
switch (format) {
1720
case 'docker': {
1821
return `-e AWS_ACCESS_KEY_ID=${key.accessKey} -e AWS_SECRET_ACCESS_KEY=${key.secretKey} -e AWS_SESSION_TOKEN=${key.sessionToken} -e AWS_SESSION_EXPIRES=${keyExpires}`;
@@ -73,6 +76,10 @@ export function getKeyOutput(
7376
case 'export': // fall through to default case
7477
case 'set':
7578
default: {
79+
console.error(
80+
'WARNING: Because this tool runs in a subshell, it cannot set environment variables in the parent shell. To use these keys, copy the commands printed below and run them in your current shell to have these environment variables set'
81+
);
82+
7683
const cmd = isWindows() || format === 'set' ? 'SET' : 'export';
7784

7885
return `${cmd} AWS_ACCESS_KEY_ID=${key.accessKey} && ${cmd} AWS_SECRET_ACCESS_KEY=${key.secretKey} && ${cmd} AWS_SESSION_TOKEN=${key.sessionToken} && ${cmd} AWS_SESSION_EXPIRES=${keyExpires}`;

0 commit comments

Comments
 (0)