Dagger
Search

file-workspace

A workspace for reading and writing files in a project

Installation

dagger install github.com/kpenfound/dag/file-workspace@90ef4ddb55dc6dc1b453c67ca4aef66773c1ae49

Entrypoint

Return Type
FileWorkspace !
Arguments
NameTypeDefault ValueDescription
sourceDirectory !-No description provided
Example
dagger -m github.com/kpenfound/dag/file-workspace@90ef4ddb55dc6dc1b453c67ca4aef66773c1ae49 call \
 --source DIR_PATH
func (m *myModule) example(source *Directory) *FileWorkspace  {
	return dag.
			FileWorkspace(source)
}
@function
def example(source: dagger.Directory) -> dag.FileWorkspace:
	return (
		dag.file_workspace(source)
	)
@func()
example(source: Directory): FileWorkspace {
	return dag
		.fileWorkspace(source)
}

Types

FileWorkspace 🔗

source() 🔗

The source directory of the project

Return Type
Directory !
Example
dagger -m github.com/kpenfound/dag/file-workspace@90ef4ddb55dc6dc1b453c67ca4aef66773c1ae49 call \
 --source DIR_PATH source
func (m *myModule) example(source *Directory) *Directory  {
	return dag.
			FileWorkspace(source).
			Source()
}
@function
def example(source: dagger.Directory) -> dagger.Directory:
	return (
		dag.file_workspace(source)
		.source()
	)
@func()
example(source: Directory): Directory {
	return dag
		.fileWorkspace(source)
		.source()
}

read() 🔗

Read a file from the project

Return Type
String !
Arguments
NameTypeDefault ValueDescription
pathString !-The path to the file
Example
dagger -m github.com/kpenfound/dag/file-workspace@90ef4ddb55dc6dc1b453c67ca4aef66773c1ae49 call \
 --source DIR_PATH read --path string
func (m *myModule) example(ctx context.Context, source *Directory, path string) string  {
	return dag.
			FileWorkspace(source).
			Read(ctx, path)
}
@function
async def example(source: dagger.Directory, path: str) -> str:
	return await (
		dag.file_workspace(source)
		.read(path)
	)
@func()
async example(source: Directory, path: string): Promise<string> {
	return dag
		.fileWorkspace(source)
		.read(path)
}

write() 🔗

Write a contents to a file in the project

Return Type
FileWorkspace !
Arguments
NameTypeDefault ValueDescription
pathString !-The path to the file
contentString !-The content to write in the file
Example
dagger -m github.com/kpenfound/dag/file-workspace@90ef4ddb55dc6dc1b453c67ca4aef66773c1ae49 call \
 --source DIR_PATH write --path string --content string
func (m *myModule) example(source *Directory, path string, content string) *FileWorkspace  {
	return dag.
			FileWorkspace(source).
			Write(path, content)
}
@function
def example(source: dagger.Directory, path: str, content: str) -> dag.FileWorkspace:
	return (
		dag.file_workspace(source)
		.write(path, content)
	)
@func()
example(source: Directory, path: string, content: string): FileWorkspace {
	return dag
		.fileWorkspace(source)
		.write(path, content)
}

listFiles() 🔗

List the files in the workspace in tree format

Return Type
String !
Example
dagger -m github.com/kpenfound/dag/file-workspace@90ef4ddb55dc6dc1b453c67ca4aef66773c1ae49 call \
 --source DIR_PATH list-files
func (m *myModule) example(ctx context.Context, source *Directory) string  {
	return dag.
			FileWorkspace(source).
			ListFiles(ctx)
}
@function
async def example(source: dagger.Directory) -> str:
	return await (
		dag.file_workspace(source)
		.list_files()
	)
@func()
async example(source: Directory): Promise<string> {
	return dag
		.fileWorkspace(source)
		.listFiles()
}