class Lolcat::CLI

Overview

Command Line Interface for the lolcat program.

This class handles the command line interface, including parsing arguments, executing the appropriate action, and handling errors.

Included Modules

Defined in:

cli.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from module Lolcat::Lol

lol(input : String, options : Options, &)
lol(input : IO, options : Options, &)
lol
, lol_cat(input : IO | String, options : Options) lol_cat, rainbow_color(freq : Float64, offset : Float64) : Tuple(UInt8, UInt8, UInt8) rainbow_color, rainbow_line(line : String, options : Options, index : Int32, pos : Int32) : String
rainbow_line(line : String, options : Options, offset : Float64) : String
rainbow_line

Constructor Detail

def self.new #

Initializes the CLI with a parser and default options.

Sets up a termination handler to reset terminal modes when the program is interrupted.


[View source]

Class Method Detail

def self.debug=(debug : Bool) #

Whether to enable debug mode (shows stack traces on errors)


[View source]
def self.debug? : Bool #

Whether to enable debug mode (shows stack traces on errors)


[View source]

Instance Method Detail

def option : Options #

The options parsed from command line arguments


[View source]
def parse_args(args = ARGV) #

Parses command line arguments and updates the options.

args: The command line arguments to parse (defaults to ARGV)

Returns the updated options


[View source]
def parser : Parser #

The command line argument parser


[View source]
def print_help #

Prints the help message with rainbow colors.


[View source]
def print_version #

Prints the version information.


[View source]
def run #

Runs the program with the parsed options.

This is the main entry point that executes the appropriate action based on the parsed command line arguments.


[View source]
def run_lolcat #

Executes the main lolcat functionality.

Processes input from ARGF (files specified on the command line or stdin) and displays it with rainbow colors.


[View source]