# cli_output URL: /api/utils/cli_output/ Section: utils -------------------------------------------------------------------------------- cli_output - Bengal window.BENGAL_THEME_DEFAULTS = { appearance: 'dark', palette: 'snow-lynx' }; // Progressive Enhancement System Configuration window.Bengal = window.Bengal || {}; window.Bengal.enhanceBaseUrl = '/bengal/assets/js/enhancements'; window.Bengal.watchDom = true; window.Bengal.debug = false; (function () { try { var defaults = window.BENGAL_THEME_DEFAULTS || { appearance: 'system', palette: '' }; var defaultAppearance = defaults.appearance; if (defaultAppearance === 'system') { defaultAppearance = (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) ? 'dark' : 'light'; } var storedTheme = localStorage.getItem('bengal-theme'); var storedPalette = localStorage.getItem('bengal-palette'); var theme = storedTheme ? (storedTheme === 'system' ? defaultAppearance : storedTheme) : defaultAppearance; var palette = storedPalette ?? defaults.palette; document.documentElement.setAttribute('data-theme', theme); if (palette) { document.documentElement.setAttribute('data-palette', palette); } } catch (e) { document.documentElement.setAttribute('data-theme', 'light'); } })(); Skip to main content Magnifying Glass ESC Recent Clear Magnifying Glass No results for "" Try different keywords or check your spelling Start typing to search... ↑↓ Navigate ↵ Open ESC Close Powered by Lunr ᓚᘏᗢ Documentation Info About Arrow Clockwise Get Started Note Tutorials File Text Content Palette Theming Settings Building Starburst Extending Bookmark Reference Learning Tracks Releases Dev GitHub API Reference bengal CLI Magnifying Glass Search ⌘K Palette Appearance Chevron Down Mode Monitor System Sun Light Moon Dark Palette Snow Lynx Brown Bengal Silver Bengal Charcoal Bengal Blue Bengal List ᓚᘏᗢ Magnifying Glass Search X Close Documentation Info About Arrow Clockwise Get Started Note Tutorials File Text Content Palette Theming Settings Building Starburst Extending Bookmark Reference Learning Tracks Releases Dev GitHub API Reference bengal CLI Palette Appearance Chevron Down Mode Monitor System Sun Light Moon Dark Palette Snow Lynx Brown Bengal Silver Bengal Charcoal Bengal Blue Bengal API Reference __main__ bengal Caret Right Folder Analysis community_detection graph_analysis graph_reporting graph_visualizer knowledge_graph link_suggestions link_types page_rank path_analysis performance_advisor results Caret Right Folder Assets manifest pipeline Caret Right Folder Autodoc base config docstring_parser utils virtual_orchestrator Caret Right Folder Extractors cli openapi python Caret Right Folder Models cli common openapi python Caret Right Folder Cache asset_dependency_map cache_store cacheable compression dependency_tracker page_discovery_cache query_index query_index_registry taxonomy_index utils Caret Right Folder Build Cache autodoc_tracking core file_tracking fingerprint parsed_content_cache rendered_output_cache taxonomy_index_mixin validation_cache Caret Right Folder Indexes author_index category_index date_range_index section_index Caret Right Folder Cli __main__ base site_templates utils Caret Right Folder Commands assets build clean collections config debug explain fix health init perf project serve site skeleton sources theme utils validate Caret Right Folder Graph __main__ bridges communities orphans pagerank report suggest Caret Right Folder New config presets scaffolds site wizard Caret Right Folder Helpers cli_app_loader cli_output config_validation error_handling menu_config metadata progress site_loader traceback validation Caret Right Folder Skeleton hydrator schema Caret Right Folder Templates base registry Caret Right Folder Blog template Caret Right Folder Changelog template Caret Right Folder Default template Caret Right Folder Docs template Caret Right Folder Landing template Caret Right Folder Portfolio template Caret Right Folder Resume template Caret Right Folder Collections errors loader schemas validator Caret Right Folder Config defaults deprecation directory_loader env_overrides environment feature_mappings hash loader merge origin_tracker validators Caret Right Folder Content Layer entry loaders manager source Caret Right Folder Sources github local notion rest Caret Right Folder Content Types base registry strategies Caret Right Folder Core build_context cascade_engine menu section theme Caret Right Folder Asset asset_core css_transforms Caret Right Folder Page computed content metadata navigation operations page_core proxy relationships utils Caret Right Folder Site core data discovery factories page_caches properties section_registry theme Caret Right Folder Debug base config_inspector content_migrator delta_analyzer dependency_visualizer explainer incremental_debugger models reporter shortcode_sandbox Caret Right Folder Discovery asset_discovery content_discovery Caret Right Folder Fonts downloader generator Caret Right Folder Health autofix base health_check report Caret Right Folder Linkcheck async_checker ignore_policy internal_checker models orchestrator Caret Right Folder Validators anchors assets cache config connectivity cross_ref fonts links menu navigation output performance rendering rss sitemap taxonomy tracks Caret Right Folder Directives analysis checkers constants Caret Right Folder Orchestration asset content full_to_incremental incremental menu postprocess related_posts render section static streaming taxonomy Caret Right Folder Postprocess html_output redirects rss sitemap special_pages Caret Right Folder Output Formats index_generator json_generator llm_generator lunr_index_generator txt_generator utils Caret Right Folder Rendering api_doc_enhancer asset_extractor errors jinja_utils link_transformer link_validator pygments_cache renderer template_context template_profiler validator Caret Right Folder Parsers base factory mistune native_html pygments_patch python_markdown Caret Right Folder Pipeline core output thread_local toc transforms Caret Right Folder Plugins badges cross_references inline_icon term variable_substitution Caret Right Folder Directives _icons admonitions badge base button cache cards checklist code_tabs container contracts data_table dropdown embed errors example_label fenced figure glossary icon include list_table literalinclude marimo navigation options rubric steps tabs target term terminal tokens utils validator video Caret Right Folder Template Engine asset_url core environment manifest menu url_helpers Caret Right Folder Template Functions advanced_collections advanced_strings autodoc collections content crossref data dates debug files get_page i18n icons images math_functions navigation pagination_helpers seo strings tables taxonomies theme urls Caret Right Folder Server build_handler component_preview constants dev_server live_reload pid_manager reload_controller request_handler request_logger resource_manager utils Caret Right Folder Services validation Caret Right Folder Themes config Caret Right Folder Utils atomic_write autodoc build_context build_stats build_summary cli_output css_minifier dates dotdict error_handlers file_io file_lock hashing incremental_constants js_bundler live_progress logger metadata observability page_initializer pagination path_resolver paths performance_collector performance_report profile progress retry rich_console sections swizzle text theme_registry theme_resolution thread_local traceback_config traceback_renderer url_normalization url_strategy API Reference Utils ᗢ Caret Down Link Copy URL External Open LLM text Copy Copy LLM text Share with AI Ask Claude Ask ChatGPT Ask Gemini Ask Copilot Module utils.cli_output Centralized CLI output system for Bengal. Provides a unified interface for all CLI messaging with: Profile-aware formatting (Writer, Theme-Dev, Developer) Consistent indentation and spacing Automatic TTY detection Rich/fallback rendering View source 3 Classes 2 Functions Classes MessageLevel Message importance levels. 0 Caret Right Message importance levels. Inherits from Enum OutputStyle Visual styles for messages. 0 Caret Right Visual styles for messages. Inherits from Enum CLIOutput Centralized CLI output manager. Handles all terminal output with profile-aware formatting, consist… 31 Caret Right Centralized CLI output manager. Handles all terminal output with profile-aware formatting, consistent spacing, and automatic TTY detection. Methods 22 should_show Determine if message should be shown based on level and settings. 1 bool Caret Right def should_show(self, level: MessageLevel) -> bool Determine if message should be shown based on level and settings. Parameters 1 level MessageLevel Returns bool header Print a header message. Example: "ᓚᘏᗢ Building your site..." 4 None Caret Right def header(self, text: str, mascot: bool = True, leading_blank: bool = True, trailing_blank: bool = True) -> None Print a header message. Example: "ᓚᘏᗢ Building your site..." Parameters 4 text str mascot bool leading_blank bool trailing_blank bool subheader Print a subheader with subtle border (lighter than header). Creates a horizont… 5 None Caret Right def subheader(self, text: str, icon: str | None = None, leading_blank: bool = True, trailing_blank: bool = False, width: int = 60) -> None Print a subheader with subtle border (lighter than header). Creates a horizontal line with text, providing visual structure without the weight of a full boxed header. Parameters 5 text str The subheader text icon str | None Optional icon/emoji to display before text leading_blank bool Add blank line before (default: True) trailing_blank bool Add blank line after (default: False) width int Total width of the border line (default: 60) phase Print a phase status line. 5 None Caret Right def phase(self, name: str, status: str = 'Done', duration_ms: float | None = None, details: str | None = None, icon: str = '✓') -> None Print a phase status line. Parameters 5 name str status str duration_ms float | None details str | None icon str detail Print a detail/sub-item. 3 None Caret Right def detail(self, text: str, indent: int = 1, icon: str | None = None) -> None Print a detail/sub-item. Parameters 3 text str indent int icon str | None success Print a success message. Example: "✨ Built 245 pages in 0.8s" 2 None Caret Right def success(self, text: str, icon: str = '✨') -> None Print a success message. Example: "✨ Built 245 pages in 0.8s" Parameters 2 text str icon str info Print an info message. 2 None Caret Right def info(self, text: str, icon: str | None = None) -> None Print an info message. Parameters 2 text str icon str | None warning Print a warning message. 2 None Caret Right def warning(self, text: str, icon: str = '⚠️') -> None Print a warning message. Parameters 2 text str icon str error Print an error message. 2 None Caret Right def error(self, text: str, icon: str = '❌') -> None Print an error message. Parameters 2 text str icon str tip Print a subtle tip/instruction line. 2 None Caret Right def tip(self, text: str, icon: str = '💡') -> None Print a subtle tip/instruction line. Parameters 2 text str icon str error_header Print an error header with mouse emoji. Example: "ᘛ⁐̤ᕐᐷ 3 template errors fou… 2 None Caret Right def error_header(self, text: str, mouse: bool = True) -> None Print an error header with mouse emoji. Example: "ᘛ⁐̤ᕐᐷ 3 template errors found" The mouse represents errors that Bengal (the cat) needs to catch! Parameters 2 text str mouse bool path Print a path. 3 None Caret Right def path(self, path: str, icon: str = '📂', label: str = 'Output') -> None Print a path. Parameters 3 path str icon str label str metric Print a metric. 4 None Caret Right def metric(self, label: str, value: Any, unit: str | None = None, indent: int = 0) -> None Print a metric. Parameters 4 label str value Any unit str | None indent int table Print a table (rich only, falls back to simple list). 2 None Caret Right def table(self, data: list[dict[str, str]], headers: list[str]) -> None Print a table (rich only, falls back to simple list). Parameters 2 data list[dict[str, str]] headers list[str] prompt Prompt user for input with themed styling. 4 Any Caret Right def prompt(self, text: str, default: Any = None, type: Any = str, show_default: bool = True) -> Any Prompt user for input with themed styling. Parameters 4 text str The prompt text to display default Any Default value if user presses enter type Any Type to convert input to (str, int, float, etc.) show_default bool Whether to show the default value Returns Any — User's input converted to the specified type confirm Prompt user for yes/no confirmation with themed styling. 2 bool Caret Right def confirm(self, text: str, default: bool = False) -> bool Prompt user for yes/no confirmation with themed styling. Parameters 2 text str The prompt text to display default bool Default value if user presses enter Returns bool — True if user confirms, False otherwise blank Print blank lines. 1 None Caret Right def blank(self, count: int = 1) -> None Print blank lines. Parameters 1 count int separator Print a horizontal separator line. 2 None Caret Right def separator(self, width: int = 78, style: str = 'dim') -> None Print a horizontal separator line. Parameters 2 width int Width of the separator line style str Style to apply (dim, info, header, etc.) file_change_notice Print a file change notification for dev server. 2 None Caret Right def file_change_notice(self, file_name: str, timestamp: str | None = None) -> None Print a file change notification for dev server. Parameters 2 file_name str Name of the changed file (or summary like "file.md (+3 more)") timestamp str | None Optional timestamp string (defaults to current time HH:MM:SS) server_url_inline Print server URL in inline format (for after rebuild). 2 None Caret Right def server_url_inline(self, host: str, port: int) -> None Print server URL in inline format (for after rebuild). Parameters 2 host str Server host port int Server port request_log_header Print table header for HTTP request logging. 0 None Caret Right def request_log_header(self) -> None Print table header for HTTP request logging. http_request Print a formatted HTTP request log line. 5 None Caret Right def http_request(self, timestamp: str, method: str, status_code: str, path: str, is_asset: bool = False) -> None Print a formatted HTTP request log line. Parameters 5 timestamp str Request timestamp (HH:MM:SS format) method str HTTP method (GET, POST, etc.) status_code str HTTP status code as string path str Request path is_asset bool Whether this is an asset request (affects icon display) Internal Methods 9 Caret Right __init__ Initialize CLI output manager. 4 None Caret Right def __init__(self, profile: Any | None = None, quiet: bool = False, verbose: bool = False, use_rich: bool | None = None) Initialize CLI output manager. Parameters 4 profile Any | None Build profile (Writer, Theme-Dev, Developer) quiet bool Suppress non-critical output verbose bool Show detailed output use_rich bool | None Force rich/plain output (None = auto-detect) _get_status_color_code Get ANSI color code for status code. 1 str Caret Right def _get_status_color_code(self, status: str) -> str Get ANSI color code for status code. Parameters 1 status str Returns str _get_method_color_code Get ANSI color code for HTTP method. 1 str Caret Right def _get_method_color_code(self, method: str) -> str Get ANSI color code for HTTP method. Parameters 1 method str Returns str _get_status_style Get Rich style name for status code. 1 str Caret Right def _get_status_style(self, status: str) -> str Get Rich style name for status code. Parameters 1 status str Returns str _get_method_style Get Rich style name for HTTP method. 1 str Caret Right def _get_method_style(self, method: str) -> str Get Rich style name for HTTP method. Parameters 1 method str Returns str _show_timing Should we show timing info based on profile? 0 bool Caret Right def _show_timing(self) -> bool Should we show timing info based on profile? Returns bool _show_details Should we show detailed info based on profile? 0 bool Caret Right def _show_details(self) -> bool Should we show detailed info based on profile? Returns bool _format_phase_line Format a phase line with consistent spacing. 1 str Caret Right def _format_phase_line(self, parts: list[str]) -> str Format a phase line with consistent spacing. Parameters 1 parts list[str] Returns str _format_path Format path based on profile (shorten for Writer, full for Developer). 1 str Caret Right def _format_path(self, path: str) -> str Format path based on profile (shorten for Writer, full for Developer). Parameters 1 path str Returns str Functions get_cli_output Get the global CLI output instance. 0 CLIOutput Caret Right def get_cli_output() -> CLIOutput Get the global CLI output instance. Returns CLIOutput init_cli_output Initialize the global CLI output instance with settings. 3 CLIOutput Caret Right def init_cli_output(profile: Any | None = None, quiet: bool = False, verbose: bool = False) -> CLIOutput Initialize the global CLI output instance with settings. Parameters 3 Name Type Default Description profile Any | None None quiet bool False verbose bool False Returns CLIOutput ← Previous build_summary Next → css_minifier List © 2025 Bengal ᓚᘏᗢ window.BENGAL_LAZY_ASSETS = { tabulator: '/bengal/assets/js/tabulator.min.js', dataTable: '/bengal/assets/js/data-table.js', mermaidToolbar: '/bengal/assets/js/mermaid-toolbar.9de5abba.js', mermaidTheme: '/bengal/assets/js/mermaid-theme.344822c5.js', graphMinimap: '/bengal/assets/js/graph-minimap.cc7e42e3.js', graphContextual: '/bengal/assets/js/graph-contextual.440e59c6.js' }; window.BENGAL_ICONS = { close: '/bengal/assets/icons/close.911d4fe1.svg', enlarge: '/bengal/assets/icons/enlarge.652035e5.svg', copy: '/bengal/assets/icons/copy.3d56e945.svg', 'download-svg': '/bengal/assets/icons/download.04f07e1b.svg', 'download-png': '/bengal/assets/icons/image.c34dfd40.svg', 'zoom-in': '/bengal/assets/icons/zoom-in.237b4a83.svg', 'zoom-out': '/bengal/assets/icons/zoom-out.38857c77.svg', reset: '/bengal/assets/icons/reset.d26dba29.svg' }; Arrow Up X -------------------------------------------------------------------------------- Metadata: - Author: lbliii - Word Count: 2455 - Reading Time: 12 minutes