Starship Prompt Builder

Custom module

Run a named command and display its output with Starship's detection, format, and style system.

When it appears

A named custom module runs only when its when or detect settings pass, and renders when its command supplies output.

Preview

Rendered from the starting configuration in a representative simulated environment.

starship — preview
project:starship-prompt-builder 

Starting configuration

[custom.project]
command = "basename $PWD"
when = true
format = "[$symbol$output]($style) "
symbol = "project:"
style = "bold yellow"
Open in the builder

The configuration is compressed into the URL fragment and stays in your browser.

Key options

commandstring
The command whose output should be printed. The command will be passed on stdin to the shell.
whenunknown
Either a boolean value (true or false, without quotes) or a string shell command used as a condition to show the module. In case of a string, the module will be shown if the shell returns a 0 status code from executing it.
formatstring
The format for the module.
symbolstring
The symbol used before displaying the command output.
stylestring
The style for the module.
shellarray
See below
detect_filesarray
The files that will be searched in the working directory for a match.
detect_foldersarray
The directories that will be searched in the working directory for a match.
detect_extensionsarray
The extensions that will be searched in the working directory for a match.
osstring
Only show this custom module on the selected operating system. Supported Rust OS values.

Format variables

$symbol
Mirrors the value of option symbol
$output
The output of command run in shell

Common adjustments

  • Keep command fast because it may execute every time the prompt renders.
  • Use detect settings to avoid running a project-specific command everywhere.
  • Audit imported commands before installing a config; they are executable local code.