-
Notifications
You must be signed in to change notification settings - Fork 8
Description
The current usage of the cobra library prevents the proper marking of flags; currently most of this sort of logic is duplicated inside of the pkg/cli/flagValues.go code implementing flagHelper (instead of using the methods provided by cobra). This is most noticeable when trying to set mutually exclusive flags, as the bundled flagHelper doesn't provide a method of implementing this.
For example:
./otdfctl --host https://platform.opentdf.local:8443 --tls-no-verify --log-level debug --with-client-creds '{"clientId":"opentdf","clientSecret":"secret"}' --json policy obligations get --id=3c51a593-cbf8-419d-b7dc-b656d0bedfbb --fqn=https://namespace.com/obl/drmCurrently returns:
ERROR Failed to find obligation (id: 3c51a593-cbf8-419d-b7dc-b656d0bedfbb): not_found: resource not foundInstead of throwing triggering a cobra error for an invalid flag combination (triggered/configured by the code here):
otdfctl/cmd/policy/obligations.go
Lines 70 to 71 in 1b5ba79
| cmd.MarkFlagsOneRequired("id", "fqn") | |
| cmd.MarkFlagsMutuallyExclusive("id", "fqn") |
Metadata
Metadata
Assignees
Labels
No labels