VOOZH about

URL: https://deepwiki.com/hypervel/prompts/6.3-notes-and-messages

⇱ Notes and Messages | hypervel/prompts | DeepWiki


Loading...
Last indexed: 7 February 2026 (2e2181)
Menu

Notes and Messages

Notes and messages are display-only components that present information to the user without requiring interaction. These functions provide a consistent way to communicate status, errors, warnings, and other important information during CLI application execution.

This page covers the seven message display functions: note(), error(), warning(), alert(), info(), intro(), and outro(). For interactive prompts that capture user input, see Interactive Prompts. For other display components like tables and progress bars, see Tables and Progress Bars and Spinners.

Function Overview

The library provides seven helper functions for displaying messages, all implemented as thin wrappers around the Note class with different type parameters:

FunctionType ParameterPurpose
note()customizableDisplay a generic note with optional custom type
error()'error'Display an error message
warning()'warning'Display a warning message
alert()'alert'Display an alert message
info()'info'Display an informational message
intro()'intro'Display an introduction/starting message
outro()'outro'Display a closing/completion message

Sources: src/helpers.php150-218

Architecture Overview

Message Function Architecture


All message functions instantiate the Note class with a message string and an optional type parameter. The Note class extends the base Prompt class and provides a display() method that renders the message through the theme system.

Sources: src/helpers.php150-218

Type System and Specialization


The specialized functions (error(), warning(), etc.) are convenience wrappers that pre-set the type parameter. The generic note() function allows passing any custom type value or null for default styling.

Sources: src/helpers.php150-218

Function Reference

note()

The generic note function displays a message with an optional type parameter for custom styling.

Signature:


Parameters:

  • $message - The message text to display
  • $type - Optional type for custom styling (e.g., 'error', 'warning', 'info', or any custom value)

Returns: void

Implementation: The function creates a new Note instance with the provided message and type, then calls display() to render it:


Sources: src/helpers.php150-158

error()

Displays an error message using the 'error' type styling.

Signature:


Parameters:

  • $message - The error message to display

Returns: void

Implementation:


Sources: src/helpers.php160-168

warning()

Displays a warning message using the 'warning' type styling.

Signature:


Parameters:

  • $message - The warning message to display

Returns: void

Implementation:


Sources: src/helpers.php170-178

alert()

Displays an alert message using the 'alert' type styling.

Signature:


Parameters:

  • $message - The alert message to display

Returns: void

Implementation:


Sources: src/helpers.php180-188

info()

Displays an informational message using the 'info' type styling.

Signature:


Parameters:

  • $message - The informational message to display

Returns: void

Implementation:


Sources: src/helpers.php190-198

intro()

Displays an introduction or starting message using the 'intro' type styling.

Signature:


Parameters:

  • $message - The introduction message to display

Returns: void

Implementation:


Commonly used at the start of a CLI application to present a welcome message or describe what the application will do.

Sources: src/helpers.php200-208

outro()

Displays a closing or completion message using the 'outro' type styling.

Signature:


Parameters:

  • $message - The closing message to display

Returns: void

Implementation:


Commonly used at the end of a CLI application to display success messages or summarize what was accomplished.

Sources: src/helpers.php210-218

Usage Patterns

Basic Message Display

All message functions follow the same simple pattern:


Application Flow Markers

Use intro() and outro() to clearly mark the beginning and end of operations:


Custom Note Types

The generic note() function accepts custom type parameters for flexibility:


Display Execution Flow

Note Display Pipeline


Each message function immediately displays output and returns control to the application. Unlike interactive prompts (see Interactive Prompts), these functions do not wait for user input.

Sources: src/helpers.php150-218

Integration with Other Display Components

Complementary Display Functions

Notes and messages work alongside other display components:


With Interactive Prompts

Messages are commonly used to provide feedback during interactive prompt workflows:


Relationship to Clear Function

The clear() function src/helpers.php87-95 is related but serves a different purpose: it clears the entire terminal screen rather than displaying a message. Unlike message functions which add content, clear() removes all existing content.

For more details on the clear() function, see Progress Bars and Spinners which documents other utility display functions.

Sources: src/helpers.php87-95 src/Clear.php1-38

Theme and Rendering Integration

Message display is controlled by the theme system. The Note class uses the configured theme's renderer to determine visual styling for each message type. Different themes can provide distinct visual presentations for 'error', 'warning', 'info', and other message types.

For details on customizing message appearance through themes, see Theme Configuration and Custom Renderers. For information on how the default renderer styles messages, see The Default Renderer.

Sources: src/helpers.php150-218