class Can::CLI::Render

Overview

Implements the can-render executable.

The CLI renders one .can file by generating a small Crystal program, compiling it with crystal run, and writing the rendered HTML to stdout or an output file. It is public so shard users can wrap the same behavior from their own command-line tools without shelling out to bin/can-render.

Defined in:

can/cli/render.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(argv : Array(String), can_require : String, can_source_dir : String) #

Creates a renderer command.

Most callers should use .run; the constructor stays public for tests and custom wrappers that want to instantiate before invoking #run.


[View source]

Class Method Detail

def self.run(argv : Array(String), can_require : String, can_source_dir : String) : Int32 #

Runs the CLI with argv and returns a process-style exit code.

can_require is the generated program's require target for Can, and can_source_dir is prepended to CRYSTAL_PATH for the nested compiler.


[View source]

Instance Method Detail

def run : Int32 #

Parses options, renders the requested template, and returns an exit code.


[View source]