#How to add examples to modules on Daggerverse

1 messages · Page 1 of 1 (latest)

sterile snow
#

I'm struggling adding examples to my modules to show up on functions in Daggerverse.
Is there any documentation on that? Or could you point me an example module?
Eventually also having Bash examples?

hallow shard
#

Not sure if we have docs for this (@midnight rain). A good example is in this module: https://github.com/marcosnils/daggerverse/tree/main/k3s (https://github.com/marcosnils/daggerverse/tree/main/k3s/examples/go).

Within examples folder you create a module with the name of the language you want to target. And within there you create functions whose name has the name of the object + name of the function. If your module is named K3S and you function is named Kubectl then the function name in the example is K3SKubectl

GitHub

Personal collection of Dagger modules. Contribute to marcosnils/daggerverse development by creating an account on GitHub.

midnight rain
#

I think there's a recent issue where examples are not being populated correctly. cc @brazen dust @feral hare. We'll check it out this week @sterile snow

brazen dust
sterile snow
#

Thanks for your help!

feral hare
midnight rain
#

hey @sterile snow I thought we had an issue with the example parsing but it seems to be running ok. Can you share which examples / module are giving you a hard time to check it out?

sterile snow
midnight rain
#

hey @sterile snow can you check if publishing a new version of the module fixes this issue? Found out that we had a bug which was preventing your examples from being correctly parsed 🙏

sterile snow
#

@midnight rain Thanks for your fix. Unfortunately it did work for my module.
v1.0.5 does not show my examples: https://daggerverse.dev/mod/github.com/puzzle/dagger-module-helm/helm@484f7b65de88ec8f801df74711d5e0c48448438f
I generated a new Dagger module with dagger init. This new structure does not have a special directory for the source.
Here, the examples show up again: https://daggerverse.dev/mod/github.com/puzzle/dagger-module-helm/helm@97290e37e1a03393d51aea01a86c8d57f0db214d#Helm.version
See the changes in the pull request: https://github.com/puzzle/dagger-module-helm/pull/41
I assume that the examples parsing had problems because of the module source not lying beside the dagger.json file.

GitHub

Use fresh generated Dagger module structure.

midnight rain
#

👋 checking this now

sterile snow
#

Thanks @midnight rain ! The examples are shown now.
I'll add other sdk examples.
How can I define Shell examples? Adding any Shell Script file with the right naming convention for the method names?
An other option would be to show the default examples for sdk's where no examples are found in the repository.