File wsh_shell_ps1_custom.h
FileList > src > wsh_shell_ps1_custom.h
Go to the source code of this file
Shell prompt (PS1) customization and formatting. More...
#include "wsh_shell_cfg.h"#include "wsh_shell_io.h"#include "wsh_shell_types.h"
Classes
| Type | Name |
|---|---|
| struct | WshShell_PS1Data_t Runtime data used for PS1 (prompt string) expansion. |
Public Functions
| Type | Name |
|---|---|
| void | WshShell_GeneratePS1 (WshShell_Char_t * pPS1, WshShell_PS1Data_t * pPS1Data) Applies the PS1 template and generates the final PS1 string. |
Detailed Description
Provides functionality for building and customizing the shell prompt (PS1). This includes dynamic substitution of runtime values such as user name, device name, and ANSI styling codes (colors, bold, reset).
Author:
Whoosh Embedded Team
Copyright:
Copyright (c) 2025
Public Functions Documentation
function WshShell_GeneratePS1
Applies the PS1 template and generates the final PS1 string.
Expands a predefined PS1 template (WSH_SHELL_PS1_TEMPLATE) into a complete PS1 string, substituting special format specifiers with runtime values like username, device name, and ANSI escape sequences for styling (colors, bold, reset).
Supported format specifiers in the template:
* u — current username (from pUser)
* d — current device name (from pDevice)
* cN — ANSI color code from predefined color map (0 ≤ N ≤ 9)
* b — ANSI escape sequence for bold text
* r — ANSI escape sequence to reset all styles
* Any unknown % sequence is copied verbatim as X.
The output is truncated if it would exceed WSH_SHELL_PS1_MAX_LEN - 1. The result is always null-terminated.
Parameters:
pPS1Output buffer for the final PS1 string. Must be at leastWSH_SHELL_PS1_MAX_LENin size.pPS1DataPointer to the user name, divice name or other strings.
The documentation for this class was generated from the following file src/wsh_shell_ps1_custom.h