@@ -105,36 +105,36 @@ export var confirm = (): Promise<boolean> => {
105
105
function accessKeyAdd ( command : cli . IAccessKeyAddCommand ) : Promise < void > {
106
106
return sdk . addAccessKey ( command . name , command . ttl )
107
107
. 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!" ) ;
111
110
} ) ;
112
111
}
113
112
114
113
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 ) ;
117
116
118
117
if ( ! willUpdateName && ! willUpdateTtl ) {
119
118
throw new Error ( "A new name and/or TTL must be provided." ) ;
120
119
}
121
120
122
121
return sdk . patchAccessKey ( command . oldName , command . newName , command . ttl )
123
122
. then ( ( accessKey : AccessKey ) => {
124
- var logMessage : string = "Successfully " ;
123
+ let logMessage : string = "Successfully " ;
125
124
if ( willUpdateName ) {
126
125
logMessage += `renamed the access key "${ command . oldName } " to "${ command . newName } "` ;
127
126
}
128
127
129
128
if ( willUpdateTtl ) {
129
+ const expirationDate = moment ( accessKey . expires ) . format ( "LLLL" ) ;
130
130
if ( willUpdateName ) {
131
- logMessage += ` and changed its expiry to ${ new Date ( accessKey . expires ) . toString ( ) } ` ;
131
+ logMessage += ` and changed its expiration date to ${ expirationDate } ` ;
132
132
} 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 } ` ;
134
134
}
135
135
}
136
136
137
- log ( logMessage + "." ) ;
137
+ log ( ` ${ logMessage } .` ) ;
138
138
} ) ;
139
139
}
140
140
0 commit comments