Rework single-value set-credentials-library logic (#1364)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2021-06-29 11:55:02 -04:00
1 parent 89dfbbe41e
commit 14c7993c2c
1 file changed
+10 -6
+10 -6
View File
@@ -324,14 +324,18 @@ func extraFlagsHandlingFuncImpl(c *Command, _ *base.FlagSets, opts *[]targets.Op
case "set-credential-libraries":
// TODO: As we add other purposes, add them to this check
if len(c.flagApplicationCredentialLibraries) == 0 {
switch len(c.flagApplicationCredentialLibraries) {
case 0:
c.UI.Error("No credential-libraries supplied via -application-credential-library")
return false
}
*opts = append(*opts, targets.WithApplicationCredentialLibraryIds(c.flagApplicationCredentialLibraries))
if len(c.flagApplicationCredentialLibraries) == 1 && c.flagApplicationCredentialLibraries[0] == "null" {
// Clear all library ids since the only value set is a null.
*opts = append(*opts, targets.DefaultApplicationCredentialLibraryIds())
case 1:
if c.flagApplicationCredentialLibraries[0] == "null" {
*opts = append(*opts, targets.DefaultApplicationCredentialLibraryIds())
break
}
fallthrough
default:
*opts = append(*opts, targets.WithApplicationCredentialLibraryIds(c.flagApplicationCredentialLibraries))
}
case "authorize-session":