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