git
This module has been generated via dagger init and serves as a reference tobasic module structure as you get started with Dagger.
Two functions have been pre-created. You can modify, delete, or add to them,
as needed. They demonstrate usage of arguments and return types using simple
echo and grep commands. The functions can be called from the dagger CLI or
from one of the SDKs.
The first line in this comment block is a short description line and the
rest is a long description with more detail on the module's purpose or usage,
if appropriate. All modules should have a short description.
Installation
dagger install github.com/disaster37/dagger-library-go/git@dafee8e572906e29bfea24a9ebef6b89b04d83a8
Entrypoint
Return Type
Git !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
baseContainer | Container | - | base container |
Example
dagger -m github.com/disaster37/dagger-library-go/git@dafee8e572906e29bfea24a9ebef6b89b04d83a8 call \
func (m *myModule) example() *Git {
return dag.
Git()
}
@function
def example() -> dag.Git:
return (
dag.git()
)
@func()
example(): Git {
return dag
.git()
}
Types
Git 🔗
baseContainer() 🔗
Return Type
Container !
Example
dagger -m github.com/disaster37/dagger-library-go/git@dafee8e572906e29bfea24a9ebef6b89b04d83a8 call \
base-container
func (m *myModule) example() *Container {
return dag.
Git().
BaseContainer()
}
@function
def example() -> dagger.Container:
return (
dag.git()
.base_container()
)
@func()
example(): Container {
return dag
.git()
.baseContainer()
}
getCurrentBranchName() 🔗
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
src | Directory ! | - | The source directory |
Example
dagger -m github.com/disaster37/dagger-library-go/git@dafee8e572906e29bfea24a9ebef6b89b04d83a8 call \
get-current-branch-name --src DIR_PATH
func (m *myModule) example(ctx context.Context, src *Directory) string {
return dag.
Git().
GetCurrentBranchName(ctx, src)
}
@function
async def example(src: dagger.Directory) -> str:
return await (
dag.git()
.get_current_branch_name(src)
)
@func()
async example(src: Directory): Promise<string> {
return dag
.git()
.getCurrentBranchName(src)
}
withCustomContainer() 🔗
Return Type
Git !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
c | Container ! | - | No description provided |
Example
dagger -m github.com/disaster37/dagger-library-go/git@dafee8e572906e29bfea24a9ebef6b89b04d83a8 call \
with-custom-container --c IMAGE:TAG
func (m *myModule) example(c *Container) *Git {
return dag.
Git().
WithCustomContainer(c)
}
@function
def example(c: dagger.Container) -> dag.Git:
return (
dag.git()
.with_custom_container(c)
)
@func()
example(c: Container): Git {
return dag
.git()
.withCustomContainer(c)
}
setConfig() 🔗
SetConfig permit to set git config
Return Type
Git !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
username | String ! | - | The git username |
String ! | - | The git email | |
baseRepoUrl | String | "github.com" | The git base repo URL |
token | Secret | - | The git token |
Example
dagger -m github.com/disaster37/dagger-library-go/git@dafee8e572906e29bfea24a9ebef6b89b04d83a8 call \
set-config --username string --email string
func (m *myModule) example(username string, email string) *Git {
return dag.
Git().
SetConfig(username, email)
}
@function
def example(username: str, email: str) -> dag.Git:
return (
dag.git()
.set_config(username, email)
)
@func()
example(username: string, email: string): Git {
return dag
.git()
.setConfig(username, email)
}
setRepo() 🔗
SetRepo permit to set git repo
Return Type
Git !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
source | Directory ! | - | the source directory |
branch | String ! | "main" | The git email |
Example
dagger -m github.com/disaster37/dagger-library-go/git@dafee8e572906e29bfea24a9ebef6b89b04d83a8 call \
set-repo --source DIR_PATH --branch string
func (m *myModule) example(source *Directory, branch string) *Git {
return dag.
Git().
SetRepo(source, branch)
}
@function
def example(source: dagger.Directory, branch: str) -> dag.Git:
return (
dag.git()
.set_repo(source, branch)
)
@func()
example(source: Directory, branch: string): Git {
return dag
.git()
.setRepo(source, branch)
}
commitAndPush() 🔗
CommitAndPush permit to commit and push
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
message | String ! | - | The commit message |
Example
dagger -m github.com/disaster37/dagger-library-go/git@dafee8e572906e29bfea24a9ebef6b89b04d83a8 call \
commit-and-push --message string
func (m *myModule) example(ctx context.Context, message string) string {
return dag.
Git().
CommitAndPush(ctx, message)
}
@function
async def example(message: str) -> str:
return await (
dag.git()
.commit_and_push(message)
)
@func()
async example(message: string): Promise<string> {
return dag
.git()
.commitAndPush(message)
}