#What happens with description of a defined Dagger Enum?

1 messages · Page 1 of 1 (latest)

primal meteor
#

The 0.12 release blog post (https://dagger.io/blog/dagger-0-12) mentions the addition of Enums, however there aren't many details.
I'm wondering if the description ("Undetermined risk; analyze further" for the Severity.UNKNOWN enum variant) is used in any way?
When I call my function that has an Enum as an argument, it just prints out a list of variants like UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL.

Powerful, programmable CI/CD engine that runs your pipelines in
containers — pre-push on your local machine and/or post-push in CI

novel mantle
#

The descriptions can be viewed as doc-strings in the generated code

#

But, yeah you can't see them in the CLI sadly - I think that would probably take up too much space, especially if there were a lot of enum values

#

But we could always revisit that description tbf!

mossy bronze
#

We can edit the blog post to link to the docs page about Enum

shrewd belfry
#

Yeah, they're most useful now from the IDE, when client bindings are generated from a dependency.

primal meteor
#

Thanks for the quick replies, a link would be great since I have troubles with finding it.

Would you ever consider adding some kind of option that would allow us to include the descriptions of Enums too? Some kind of a verbosity flag? It could be such that it's one enum variant per line.

ARGUMENTS
     --severity
         - UNKNOWN     Undetermined risk; analyze further
         - LOW          Minimal risk; routine fix

It's a nice feature for someone who's playing around with pipelines, but didn't author them. I'm thinking of ways they could use Dagger CLI to get all the info they need.

shrewd belfry
#

I'm up for it as I've seen this pattern in some CLIs.

novel mantle
#

Yeah, I'd be alright with that 😄

#

@primal meteor any chance you could open an issue?

primal meteor
#

@Jed Of course! 🙂

shrewd belfry
#

uv used to do that, but it seems they've simplified the output now. Example:
Before uv help run

      --resolution <RESOLUTION>
          The strategy to use when selecting between the different compatible versions for a given package
          requirement.

          By default, `uv` will use the latest compatible version of each package (`highest`).

          [env: UV_RESOLUTION=]

          Possible values:
          - highest:       Resolve the highest compatible version of each package
          - lowest:        Resolve the lowest compatible version of each package
          - lowest-direct: Resolve the lowest compatible version of any direct dependencies, and the highest
            compatible version of any transitive dependencies

Now uv run --help

      --resolution <RESOLUTION>
          The strategy to use when selecting between the different compatible versions for a given package
          requirement [env: UV_RESOLUTION=] [possible values: highest, lowest, lowest-direct]

EDIT: Oh, they use a more compact help when doing uv <command> --help but more information when doing uv help <command>.

mossy bronze
#

It looks like perhaps we don't have a docs page for the new enums.. cc @muted fjord

#

(or at least I couldn't find it)

muted fjord
#

No there's not, @queen river is it in your list or should I take care of that?

mossy bronze
#

Vikram is on vacation

#

Maybe something very simple to start, and we can improve it later

muted fjord
#

Yeah, just the basic example,

queen river
muted fjord
mossy bronze
#

I think it's a good opportunity to test the principle that new features should be contributed with (at least basic) docs

queen river
# muted fjord Nw, I'm on it 😉 enjoy your vacation

Ok, lmk if you need help. Remember it should be a multi-lang page/example or if that's not applicable, the applicable languages should be called out in the page (there are some examples of this already). Ping me if you need more info.

mossy bronze
#

We already have an example from the blog post so that should help

primal meteor
#

For what it's worth, the blog post examples are a great introduction.

primal meteor