workspace
No long description provided.
Installation
dagger install github.com/lgtdio/melvin/workspace@d5b477feb1036e6f1ec6f4cbb9d4a6cde0511133
Entrypoint
Return Type
Workspace !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
checker | Container | - | A builder container, for verifying that the code builds, tests run etc. Container spec: - Workspace will be mounted to container workdir - Container default args will be executed. - Exit code 0 is considered a successful check. Otherwise a failure. |
start | Directory | - | Initial state to start the workspace from By default the workspace starts empty |
Example
dagger -m github.com/lgtdio/melvin/workspace@d5b477feb1036e6f1ec6f4cbb9d4a6cde0511133 call \
func (m *myModule) example() *Workspace {
return dag.
Workspace()
}
@function
def example() -> dag.Workspace:
return (
dag.workspace()
)
@func()
example(): Workspace {
return dag
.workspace()
}
Types
Workspace 🔗
A workspace for editing files and checking the result
dir() 🔗
An immutable snapshot of the workspace contents
Return Type
Directory !
Example
dagger -m github.com/lgtdio/melvin/workspace@d5b477feb1036e6f1ec6f4cbb9d4a6cde0511133 call \
dir
func (m *myModule) example() *Directory {
return dag.
Workspace().
Dir()
}
@function
def example() -> dagger.Directory:
return (
dag.workspace()
.dir()
)
@func()
example(): Directory {
return dag
.workspace()
.dir()
}
check() 🔗
Check that the current contents is valid This is done by executed an externally-provided checker container with the workspace mounted. If there is no checker, the check will always pass
Return Type
String !
Example
dagger -m github.com/lgtdio/melvin/workspace@d5b477feb1036e6f1ec6f4cbb9d4a6cde0511133 call \
check
func (m *myModule) example(ctx context.Context) string {
return dag.
Workspace().
Check(ctx)
}
@function
async def example() -> str:
return await (
dag.workspace()
.check()
)
@func()
async example(): Promise<string> {
return dag
.workspace()
.check()
}
diff() 🔗
Return all changes to the workspace since the start of the session, in unified diff format, with the following convention: - before/ is the start state - after/ is the current state
Return Type
String !
Example
dagger -m github.com/lgtdio/melvin/workspace@d5b477feb1036e6f1ec6f4cbb9d4a6cde0511133 call \
diff
func (m *myModule) example(ctx context.Context) string {
return dag.
Workspace().
Diff(ctx)
}
@function
async def example() -> str:
return await (
dag.workspace()
.diff()
)
@func()
async example(): Promise<string> {
return dag
.workspace()
.diff()
}
checkpoint() 🔗
Checkpoint the current state of the workspace, with a description of the changes made.
Return Type
Workspace !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
description | String ! | - | No description provided |
Example
dagger -m github.com/lgtdio/melvin/workspace@d5b477feb1036e6f1ec6f4cbb9d4a6cde0511133 call \
checkpoint --description string
func (m *myModule) example(description string) *Workspace {
return dag.
Workspace().
Checkpoint(description)
}
@function
def example(description: str) -> dag.Workspace:
return (
dag.workspace()
.checkpoint(description)
)
@func()
example(description: string): Workspace {
return dag
.workspace()
.checkpoint(description)
}
history() 🔗
Return a history of all checkpoints so far, from first to last
Return Type
[String ! ] !
Example
dagger -m github.com/lgtdio/melvin/workspace@d5b477feb1036e6f1ec6f4cbb9d4a6cde0511133 call \
history
func (m *myModule) example(ctx context.Context) []string {
return dag.
Workspace().
History(ctx)
}
@function
async def example() -> List[str]:
return await (
dag.workspace()
.history()
)
@func()
async example(): Promise<string[]> {
return dag
.workspace()
.history()
}
reset() 🔗
Reset the workspace to its starting state. Warning: this will wipe all changes made during the current session
Return Type
Workspace !
Example
dagger -m github.com/lgtdio/melvin/workspace@d5b477feb1036e6f1ec6f4cbb9d4a6cde0511133 call \
reset
func (m *myModule) example() *Workspace {
return dag.
Workspace().
Reset()
}
@function
def example() -> dag.Workspace:
return (
dag.workspace()
.reset()
)
@func()
example(): Workspace {
return dag
.workspace()
.reset()
}
write() 🔗
Write to a file in the workspace
Return Type
Workspace !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
path | String ! | - | The path of the file to write |
contents | String ! | - | The contents to write |
Example
dagger -m github.com/lgtdio/melvin/workspace@d5b477feb1036e6f1ec6f4cbb9d4a6cde0511133 call \
write --path string --contents string
func (m *myModule) example(path string, contents string) *Workspace {
return dag.
Workspace().
Write(path, contents)
}
@function
def example(path: str, contents: str) -> dag.Workspace:
return (
dag.workspace()
.write(path, contents)
)
@func()
example(path: string, contents: string): Workspace {
return dag
.workspace()
.write(path, contents)
}
copyDir() 🔗
Copy an entire directory into the workspace
Return Type
Workspace !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
path | String ! | - | The target path |
dir | Directory ! | - | The directory to copy at the target path. Existing content is overwritten at the file granularity. |
Example
dagger -m github.com/lgtdio/melvin/workspace@d5b477feb1036e6f1ec6f4cbb9d4a6cde0511133 call \
copy-dir --path string --dir DIR_PATH
func (m *myModule) example(path string, dir *Directory) *Workspace {
return dag.
Workspace().
CopyDir(path, dir)
}
@function
def example(path: str, dir: dagger.Directory) -> dag.Workspace:
return (
dag.workspace()
.copy_dir(path, dir)
)
@func()
example(path: string, dir: Directory): Workspace {
return dag
.workspace()
.copyDir(path, dir)
}
read() 🔗
Read the contents of a file in thw workspace
Return Type
String !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
path | String ! | - | No description provided |
Example
dagger -m github.com/lgtdio/melvin/workspace@d5b477feb1036e6f1ec6f4cbb9d4a6cde0511133 call \
read --path string
func (m *myModule) example(ctx context.Context, path string) string {
return dag.
Workspace().
Read(ctx, path)
}
@function
async def example(path: str) -> str:
return await (
dag.workspace()
.read(path)
)
@func()
async example(path: string): Promise<string> {
return dag
.workspace()
.read(path)
}
rm() 🔗
Remove a file from the workspace
Return Type
Workspace !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
path | String ! | - | No description provided |
Example
dagger -m github.com/lgtdio/melvin/workspace@d5b477feb1036e6f1ec6f4cbb9d4a6cde0511133 call \
rm --path string
func (m *myModule) example(path string) *Workspace {
return dag.
Workspace().
Rm(path)
}
@function
def example(path: str) -> dag.Workspace:
return (
dag.workspace()
.rm(path)
)
@func()
example(path: string): Workspace {
return dag
.workspace()
.rm(path)
}
rmDir() 🔗
Remove a directory from the workspace
Return Type
Workspace !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
path | String ! | - | No description provided |
Example
dagger -m github.com/lgtdio/melvin/workspace@d5b477feb1036e6f1ec6f4cbb9d4a6cde0511133 call \
rm-dir --path string
func (m *myModule) example(path string) *Workspace {
return dag.
Workspace().
RmDir(path)
}
@function
def example(path: str) -> dag.Workspace:
return (
dag.workspace()
.rm_dir(path)
)
@func()
example(path: string): Workspace {
return dag
.workspace()
.rmDir(path)
}
listDir() 🔗
List the contents of a directory in the workspace
Return Type
[String ! ] !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
path | String | "/" | Path of the target directory |
Example
dagger -m github.com/lgtdio/melvin/workspace@d5b477feb1036e6f1ec6f4cbb9d4a6cde0511133 call \
list-dir
func (m *myModule) example(ctx context.Context) []string {
return dag.
Workspace().
ListDir(ctx)
}
@function
async def example() -> List[str]:
return await (
dag.workspace()
.list_dir()
)
@func()
async example(): Promise<string[]> {
return dag
.workspace()
.listDir()
}
walk() 🔗
Walk all files in the workspace (optionally filtered by a glob pattern), and return their path.
Return Type
[String ! ] !
Arguments
Name | Type | Default Value | Description |
---|---|---|---|
pattern | String | "**" | A glob pattern to filter files. Only matching files will be included. The glob format is the same as Dockerfile/buildkit |
Example
dagger -m github.com/lgtdio/melvin/workspace@d5b477feb1036e6f1ec6f4cbb9d4a6cde0511133 call \
walk
func (m *myModule) example(ctx context.Context) []string {
return dag.
Workspace().
Walk(ctx)
}
@function
async def example() -> List[str]:
return await (
dag.workspace()
.walk()
)
@func()
async example(): Promise<string[]> {
return dag
.workspace()
.walk()
}