class
Lolcat::CLI
- Lolcat::CLI
- Reference
- Object
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.crConstructors
-
.new
Initializes the CLI with a parser and default options.
Class Method Summary
-
.debug=(debug : Bool)
Whether to enable debug mode (shows stack traces on errors)
-
.debug? : Bool
Whether to enable debug mode (shows stack traces on errors)
Instance Method Summary
-
#option : Options
The options parsed from command line arguments
-
#parse_args(args = ARGV)
Parses command line arguments and updates the options.
-
#parser : Parser
The command line argument parser
-
#print_help
Prints the help message with rainbow colors.
-
#print_version
Prints the version information.
-
#run
Runs the program with the parsed options.
-
#run_lolcat
Executes the main lolcat functionality.
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
Initializes the CLI with a parser and default options.
Sets up a termination handler to reset terminal modes when the program is interrupted.
Class Method Detail
Instance Method Detail
Parses command line arguments and updates the options.
args: The command line arguments to parse (defaults to ARGV)
Returns the updated options
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.
Executes the main lolcat functionality.
Processes input from ARGF (files specified on the command line or stdin) and displays it with rainbow colors.