Tag Injection Across Modules #3006
Replies: 2 comments
-
i tried; ''' this will output both packages, but the injection isnt working like you would think and foovar is not defined in :foo |
Beta Was this translation helpful? Give feedback.
-
I don't believe this is currently possible
tl;dr tag injection is part of the Another thing to consider, what would happen if you use a tag and one of the 3rd party modules you import has the same tag, but expects a different kind of value. Thus it makes sense to only process tags at the top-level (entrypoint package) and ignore others. Typically and generally speaking, libraries don't expose flags directly, but may give you a handle to expose them in your own applications. You should be define the flags and then expose them like so -- library.cue --
package library
#flags: {
foo: string @tag(foo)
}
#thing: {
flags: #flags
bar: *flags.foo | "bar"
}
-- main.cue --
package main
import "foo.com/library"
myflags: library.#flags
thing: library.#thing & { flags: myflags }
|
Beta Was this translation helpful? Give feedback.
-
Hello,
I have a module with a bunch of packages that I import and use across files. I want to specify tags in one file and be able to inject the tags from another file. However, this seems to be impossible so I wanted to post here asking for suggestions!
library.cue
main.cue
This command works, as expected
I want to be able to call this from the command line as so:
But this returns with the following error:
no tag for "injectedValue"
Is there any way I can get this to work? Any help would be deeply appreciated thank you!
Beta Was this translation helpful? Give feedback.
All reactions