Hwaro::CLI
Constants
BASE_URL_FLAG = FlagInfo.new(short: nil, long: "--base-url", description: "Override base_url from config.toml", takes_value: true, value_hint: "URL")
CONTENT_DIR_FLAG = FlagInfo.new(short: "-c", long: "--content-dir", description: "Content directory (default: content)", takes_value: true, value_hint: "DIR")
DEBUG_FLAG = FlagInfo.new(short: nil, long: "--debug", description: "Print debug information")
DRAFTS_FLAG = FlagInfo.new(short: "-d", long: "--drafts", description: "Include draft content")
ENV_FLAG = FlagInfo.new(short: "-e", long: "--env", description: "Environment name (loads config.<env>.toml override)", takes_value: true, value_hint: "ENV")
HELP_FLAG = FlagInfo.new(short: "-h", long: "--help", description: "Show this help")
Common help flag used by all commands
INCLUDE_EXPIRED_FLAG = FlagInfo.new(short: nil, long: "--include-expired", description: "Include expired content")
INCLUDE_FUTURE_FLAG = FlagInfo.new(short: nil, long: "--include-future", description: "Include future-dated content")
INPUT_DIR_FLAG = FlagInfo.new(short: "-i", long: "--input", description: "Input directory (default: current directory)", takes_value: true, value_hint: "DIR")
JOBS_FLAG = FlagInfo.new(short: nil, long: "--jobs", description: "Concurrent render workers (default: auto). Try 1-2 for template-heavy sites", takes_value: true, value_hint: "N")
JSON_FLAG = FlagInfo.new(short: "-j", long: "--json", description: "Output result as JSON")
Common JSON output flag
MINIFY_FLAG = FlagInfo.new(short: nil, long: "--minify", description: "Minify HTML/JSON/XML output (strips comments, intra-tag and inter-tag whitespace by neighbour class; preserves pre/code/script/style/svg/math/textarea/noscript)")
NO_OPEN_BROWSER_FLAG = FlagInfo.new(short: nil, long: "--no-open", description: "Do not open browser after starting server (default behavior)")
OPEN_BROWSER_FLAG = FlagInfo.new(short: nil, long: "--open", description: "Open browser after starting server")
PROFILE_FLAG = FlagInfo.new(short: nil, long: "--profile", description: "Show build timing profile")
QUIET_FLAG = FlagInfo.new(short: "-q", long: "--quiet", description: "Suppress info output and banner (errors still shown on stderr)")
SKIP_CACHE_BUSTING_FLAG = FlagInfo.new(short: nil, long: "--skip-cache-busting", description: "Disable cache busting query parameters on CSS/JS resources")
SKIP_IMAGE_PROCESSING_FLAG = FlagInfo.new(short: nil, long: "--skip-image-processing", description: "Skip image resizing and LQIP generation")
SKIP_OG_IMAGE_FLAG = FlagInfo.new(short: nil, long: "--skip-og-image", description: "Skip auto OG image generation")
VERBOSE_FLAG = FlagInfo.new(short: "-v", long: "--verbose", description: "Show detailed output")
Global flags - shared across multiple commands
Class methods
register_base_url(parser : OptionParser, &block : String -> )
Register the shared --base-url flag, validating the value and raising a
usage error on a malformed URL. Yields the validated value to block.
register_flag(parser : OptionParser, flag : FlagInfo, &block : String -> )
Register a FlagInfo on an OptionParser, eliminating manual duplication between FLAGS metadata and OptionParser definitions.
register_jobs(parser : OptionParser, &block : Int32 -> )
Register the shared --jobs flag, parsing a positive worker count and
raising a usage error otherwise. Yields the parsed Int32 to block.