Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 4d884c2

Browse files
committed
gulp
1 parent 363ec64 commit 4d884c2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

cli/script/command-executor.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,36 +105,36 @@ export var confirm = (): Promise<boolean> => {
105105
function accessKeyAdd(command: cli.IAccessKeyAddCommand): Promise<void> {
106106
return sdk.addAccessKey(command.name, command.ttl)
107107
.then((accessKey: AccessKey) => {
108-
log(`Successfully created a new access key "${command.name}": ${accessKey.key}`);
109-
log(`(Expires: ${new Date(accessKey.expires).toString()})`);
110-
log(`Please save this key as it will only be shown once!`);
108+
log(`Successfully created the "${command.name}" access key: ${accessKey.key}`);
109+
log("Make sure to save this key value somewhere safe, since you won't be able to view it from the CLI again!");
111110
});
112111
}
113112

114113
function accessKeyPatch(command: cli.IAccessKeyPatchCommand): Promise<void> {
115-
var willUpdateName: boolean = isCommandOptionSpecified(command.newName) && command.oldName !== command.newName;
116-
var willUpdateTtl: boolean = isCommandOptionSpecified(command.ttl);
114+
const willUpdateName: boolean = isCommandOptionSpecified(command.newName) && command.oldName !== command.newName;
115+
const willUpdateTtl: boolean = isCommandOptionSpecified(command.ttl);
117116

118117
if (!willUpdateName && !willUpdateTtl) {
119118
throw new Error("A new name and/or TTL must be provided.");
120119
}
121120

122121
return sdk.patchAccessKey(command.oldName, command.newName, command.ttl)
123122
.then((accessKey: AccessKey) => {
124-
var logMessage: string = "Successfully ";
123+
let logMessage: string = "Successfully ";
125124
if (willUpdateName) {
126125
logMessage += `renamed the access key "${command.oldName}" to "${command.newName}"`;
127126
}
128127

129128
if (willUpdateTtl) {
129+
const expirationDate = moment(accessKey.expires).format("LLLL");
130130
if (willUpdateName) {
131-
logMessage += ` and changed its expiry to ${new Date(accessKey.expires).toString()}`;
131+
logMessage += ` and changed its expiration date to ${expirationDate}`;
132132
} else {
133-
logMessage += `changed the access key "${command.oldName}"'s expiry to ${new Date(accessKey.expires).toString()}`;
133+
logMessage += `changed the expiration date of the "${command.oldName}" access key to ${expirationDate}`;
134134
}
135135
}
136136

137-
log(logMessage + ".");
137+
log(`${logMessage}.`);
138138
});
139139
}
140140

0 commit comments

Comments
 (0)