tart login: trim newline characters at the end of --password-stdin (#486)

This commit is contained in:
Nikolay Edigaryev 2023-05-04 14:02:46 +04:00 committed by GitHub
parent 37ae7888e6
commit 6de31de6bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -35,6 +35,9 @@ struct Login: AsyncParsableCommand {
let passwordData = FileHandle.standardInput.readDataToEndOfFile()
password = String(decoding: passwordData, as: UTF8.self)
// Support "echo $PASSWORD | tart login --username $USERNAME --password-stdin $REGISTRY"
password.trimSuffix { c in c.isNewline }
} else {
(user, password) = try StdinCredentials.retrieve()
}