mod
The functions are used inside the hands-on lab: https://dagger-techlab.puzzle.ch/Installation
dagger install github.com/puzzle/dagger-techlab/mod@e6aad328bf32f1c31154625792a90e061ccbd295Entrypoint
Return Type
Mod Example
dagger -m github.com/puzzle/dagger-techlab/mod@e6aad328bf32f1c31154625792a90e061ccbd295 call \
func (m *MyModule) Example() *dagger.Mod {
return dag.
Mod()
}@function
def example() -> dagger.Mod:
return (
dag.mod()
)@func()
example(): Mod {
return dag
.mod()
}Types
Mod 🔗
hello() 🔗
Say hello to the world! Code taken from https://github.com/shykes/hello. Thanks!
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| greeting | String | "hello" | Change the greeting |
| name | String | "world" | Change the name |
| giant | Boolean | - | Encode the message in giant multi-character letters |
| shout | Boolean | - | Make the message uppercase, and add more exclamation points |
| figletContainer | Container | - | Custom container for running the figlet tool |
Example
dagger -m github.com/puzzle/dagger-techlab/mod@e6aad328bf32f1c31154625792a90e061ccbd295 call \
hellofunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Mod().
Hello(ctx)
}@function
async def example() -> str:
return await (
dag.mod()
.hello()
)@func()
async example(): Promise<string> {
return dag
.mod()
.hello()
}ls() 🔗
Returns the files of the directory
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| dir | Directory ! | - | directory to list it's files |
Example
dagger -m github.com/puzzle/dagger-techlab/mod@e6aad328bf32f1c31154625792a90e061ccbd295 call \
ls --dir DIR_PATHfunc (m *MyModule) Example(ctx context.Context, dir *dagger.Directory) string {
return dag.
Mod().
Ls(ctx, dir)
}@function
async def example(dir: dagger.Directory) -> str:
return await (
dag.mod()
.ls(dir)
)@func()
async example(dir: Directory): Promise<string> {
return dag
.mod()
.ls(dir)
}os() 🔗
Returns the operating system of the container
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ctr | Container ! | - | container to get is's OS |
Example
dagger -m github.com/puzzle/dagger-techlab/mod@e6aad328bf32f1c31154625792a90e061ccbd295 call \
os --ctr IMAGE:TAGfunc (m *MyModule) Example(ctx context.Context, ctr *dagger.Container) string {
return dag.
Mod().
Os(ctx, ctr)
}@function
async def example(ctr: dagger.Container) -> str:
return await (
dag.mod()
.os(ctr)
)@func()
async example(ctr: Container): Promise<string> {
return dag
.mod()
.os(ctr)
}unlock() 🔗
Returns the answer to everything when the password is right.
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| password | Secret ! | - | container to get is's OS |
Example
dagger -m github.com/puzzle/dagger-techlab/mod@e6aad328bf32f1c31154625792a90e061ccbd295 call \
unlock --password env:MYSECRETfunc (m *MyModule) Example(ctx context.Context, password *dagger.Secret) string {
return dag.
Mod().
Unlock(ctx, password)
}@function
async def example(password: dagger.Secret) -> str:
return await (
dag.mod()
.unlock(password)
)@func()
async example(password: Secret): Promise<string> {
return dag
.mod()
.unlock(password)
}