Dagger
Search

dagger-cog

Cog CLI - generate content with inlined Python code.

Installation

dagger install github.com/staticaland/dagger-cog@v1.1.0

Entrypoint

Return Type
DaggerCog
Example
dagger -m github.com/staticaland/dagger-cog@38ca84189b803d744c72fd382954e8c8ff88ca2d call \
func (m *myModule) example() *DaggerCog  {
	return dag.
			DaggerCog()
}
@function
def example() -> dag.DaggerCog:
	return (
		dag.dagger_cog()
	)
@func()
example(): DaggerCog {
	return dag
		.daggerCog()
}

Types

DaggerCog 🔗

cog() 🔗

Cog runs the cog command on the provided file within a Python container. It installs the cogapp package, copies the directory into the container, and executes cog with the specified options.

Parameters:

ctx          - The context for the operation.
checksum     - Checksum the output to protect it against accidental change. (optional)
delete       - Delete the generator code from the output file. (optional)
warnEmpty    - Warn if a file has no cog code in it. (optional)
includePaths - Add PATH to the list of directories for data files and modules. (optional)
encoding     - Use ENCODING when reading and writing files. (optional)
outputName   - Write the output to OUTNAME. (optional)
prologue     - Prepend the generator source with PROLOGUE. (optional)
usePrint     - Use print() instead of cog.outl() for code output. (optional)
replace      - Replace the input file with the output. (optional)
suffix       - Suffix all generated output lines with STRING. (optional)
unixNewlines - Write the output with Unix newlines (only LF line-endings). (optional)
writeCmd     - Use CMD if the output file needs to be made writable. (optional)
excise       - Excise all the generated output without running the generators. (optional)
assumeOutput - The end-output marker can be omitted, and is assumed at eof. (optional)
markers      - The patterns surrounding cog inline instructions. (optional)
verbosity    - Control the amount of output. (optional)
file         - The input file to be processed by cog.
source       - The directory containing the file to be processed by cog.

Returns:

*dagger.Directory - The processed directory.
Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
checksumBoolean -Checksum the output to protect it against accidental change.
deleteBoolean -Delete the generator code from the output file.
warnEmptyBoolean -Warn if a file has no cog code in it.
includePaths[String ! ] -Add PATH to the list of directories for data files and modules.
encodingString -Use ENCODING when reading and writing files.
outputNameString -Write the output to OUTNAME.
prologueString -Prepend the generator source with PROLOGUE.
usePrintBoolean -Use print() instead of cog.outl() for code output.
replaceBoolean -Replace the input file with the output.
suffixString -Suffix all generated output lines with STRING.
unixNewlinesBoolean -Write the output with Unix newlines (only LF line-endings).
writeCmdString -Use CMD if the output file needs to be made writable.
exciseBoolean -Excise all the generated output without running the generators.
assumeOutputBoolean -The end-output marker can be omitted, and is assumed at eof.
markersString -The patterns surrounding cog inline instructions.
verbosityInteger -Control the amount of output.
fileString !-The input file to be processed by cog.
sourceDirectory -No description provided
Example
dagger -m github.com/staticaland/dagger-cog@38ca84189b803d744c72fd382954e8c8ff88ca2d call \
 cog --file string
func (m *myModule) example(file string) *Directory  {
	return dag.
			DaggerCog().
			Cog(file)
}
@function
def example(file: str) -> dagger.Directory:
	return (
		dag.dagger_cog()
		.cog(file)
	)
@func()
example(file: string): Directory {
	return dag
		.daggerCog()
		.cog(file)
}