(profile: string, options: CredentialsOptions = {})
| 115 | } |
| 116 | |
| 117 | export function deleteProfile(profile: string, options: CredentialsOptions = {}): boolean { |
| 118 | const path = resolvePath(options); |
| 119 | const file = readCredentialsFile(options); |
| 120 | if (!(profile in file)) return false; |
| 121 | delete file[profile]; |
| 122 | if (Object.keys(file).length === 0) { |
| 123 | writeCredentialsAtomic(path, {}); |
| 124 | } else { |
| 125 | writeCredentialsAtomic(path, file); |
| 126 | } |
| 127 | return true; |
| 128 | } |
| 129 | |
| 130 | export function ensureRestrictiveMode(path: string): void { |
| 131 | if (!existsSync(path)) return; |
no test coverage detected