Dagger
Search

linguist

Mostly used for confirming that a .gitattributes file correctly marks a given file as being generated.

Note: there's an issue when cache is cold. The linguist repo is pulled with dag.git() which also pulls in the submodules. Every language in Linguist is in an external repo, commited as a submodule, so it takes approximately 10 minutes to pull the entire thing.

Installation

dagger install github.com/helderco/daggerverse/linguist@v0.2.1

Entrypoint

Return Type
Linguist !
Arguments
NameTypeDescription
srcDirectory !The directory containing the source code to analyze
commitString !The Git commit for the Linguist repository to use
Example
func (m *myModule) example(src *Directory, commit string) *Linguist  {
	return dag.
			Linguist(src, commit)
}
@function
def example(src: dagger.Directory, commit: str) -> dag.Linguist:
	return (
		dag.linguist(src, commit)
	)
@func()
example(src: Directory, commit: string): Linguist {
	return dag
		.linguist(src, commit)
}

Types

Linguist

Build Linguist and analyze a git repository

src()

The directory containing the source code to analyze

Return Type
Directory !
Example
dagger -m github.com/helderco/daggerverse/linguist@d678847b11ec519333d3c0c45f320a02399be3ea call \
 --src DIR_PATH --commit string src
func (m *myModule) example(src *Directory, commit string) *Directory  {
	return dag.
			Linguist(src, commit).
			Src()
}
@function
def example(src: dagger.Directory, commit: str) -> dagger.Directory:
	return (
		dag.linguist(src, commit)
		.src()
	)
@func()
example(src: Directory, commit: string): Directory {
	return dag
		.linguist(src, commit)
		.src()
}

repo()

The Linguist GitHub repository to build

Return Type
String !
Example
dagger -m github.com/helderco/daggerverse/linguist@d678847b11ec519333d3c0c45f320a02399be3ea call \
 --src DIR_PATH --commit string repo
func (m *myModule) example(ctx context.Context, src *Directory, commit string) string  {
	return dag.
			Linguist(src, commit).
			Repo(ctx)
}
@function
async def example(src: dagger.Directory, commit: str) -> str:
	return await (
		dag.linguist(src, commit)
		.repo()
	)
@func()
async example(src: Directory, commit: string): Promise<string> {
	return dag
		.linguist(src, commit)
		.repo()
}

commit()

The Git commit for the Linguist repository to use

Return Type
String !
Example
dagger -m github.com/helderco/daggerverse/linguist@d678847b11ec519333d3c0c45f320a02399be3ea call \
 --src DIR_PATH --commit string commit
func (m *myModule) example(ctx context.Context, src *Directory, commit string) string  {
	return dag.
			Linguist(src, commit).
			Commit(ctx)
}
@function
async def example(src: dagger.Directory, commit: str) -> str:
	return await (
		dag.linguist(src, commit)
		.commit()
	)
@func()
async example(src: Directory, commit: string): Promise<string> {
	return dag
		.linguist(src, commit)
		.commit()
}

run()

Run the github-linguist tool on the source code

Return Type
String !
Arguments
NameTypeDefault ValueDescription
fileString !""Path to a single file to analyze
revString !""The git revision to analyze
breakdownBoolean !falseShow the breakdown of files by language
asJsonBoolean !falseOutput the Linguist data in JSON format
Example
dagger -m github.com/helderco/daggerverse/linguist@d678847b11ec519333d3c0c45f320a02399be3ea call \
 --src DIR_PATH --commit string run --file string --rev string --breakdown boolean --as-json boolean
func (m *myModule) example(ctx context.Context, src *Directory, commit string, file string, rev string, breakdown bool, asJson bool) string  {
	return dag.
			Linguist(src, commit).
			Run(ctx, file, rev, breakdown, asJson)
}
@function
async def example(src: dagger.Directory, commit: str, file: str, rev: str, breakdown: bool, as_json: bool) -> str:
	return await (
		dag.linguist(src, commit)
		.run(file, rev, breakdown, as_json)
	)
@func()
async example(src: Directory, commit: string, file: string, rev: string, breakdown: boolean, asJson: boolean): Promise<string> {
	return dag
		.linguist(src, commit)
		.run(file, rev, breakdown, asJson)
}