This repository has been archived by the owner on Nov 18, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cue: add function for Value.Attributes()
First attempt by @verdverm, significant edits by @mpvl. The API has been designed so that new attribute types can be added without breaking anything: the user will always have to explicitly specify the types of attributes that are needed. This also adds the NumArgs, Arg, and RawArg methods to give access to the attribute fields. This does not handle duplicate attributes. In the future, there could be merge functionality for this purpose. This could be done by adding option flags if we can settle on what constitutes good options. Original comments from Tony: This enables a user of the Go API to get all attributes so they can inspect them, rather than only being able to ask if a particular attribute exists on a value. Really useful for tools leveraging CUE! I recall @mpvl might have wanted the return to be a Value or List rather than the slice? Closes #529 #529 GitOrigin-RevId: 6a8951a Change-Id: Ie3cc9983656864fa44852b924a3142c82e336f4a Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9201 Reviewed-by: CUE cueckoo <[email protected]> Reviewed-by: Marcel van Lohuizen <[email protected]>
- Loading branch information
Showing
3 changed files
with
204 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters