Features
- command: remove command segment (6180d88)
BREAKING CHANGES
- command: The command segment has been completely removed.
Users must update configurations to use built-in segments or
alternative approaches.
The following built-in themes have been updated to remove command
segments:
pararussel.omp.json- Removed git commit time displaytokyonight_storm.omp.json- Removed git commit time displayglowsticks.omp.yaml- Removed custom git status and weather segments
If your configuration uses the command segment, you have several
alternatives:
Replace command segments with equivalent built-in segments where
possible:
Before (command segment):
{
"type": "command",
"properties": {
"command": "git log --pretty=format:%cr -1",
"shell": "bash"
}
}After (git segment):
{
"type": "git",
"properties": {
"branch_icon": "",
"commit_icon": "",
"tag_icon": ""
},
"template": "{{ .HEAD }} ({{ .Behind }}{{ .Ahead }})"
}Oh My Posh provides a set_poshcontext shell function that allows you
to populate environment variables before each prompt render. This is
perfect for replacing command segments:
Before (command segment):
{
"type": "command",
"properties": {
"command": "git log --pretty=format:%cr -1 || echo 'No commits'",
"shell": "bash"
}
}After (using set_poshcontext + text segment):
Shell configuration (e.g., .bashrc, .zshrc):
function set_poshcontext() {
export POSH_GIT_LAST_COMMIT=$(git log --pretty=format:%cr -1 2>/dev/null || echo 'No commits')
}Oh My Posh configuration:
{
"type": "text",
"template": "{{ .Env.POSH_GIT_LAST_COMMIT }}"
}For complex shell commands, consider:
-
Moving logic to external scripts
-
Using environment variables set by shell initialization
-
Implementing custom segments (for advanced users)
-
Text segment: For static text replacement
-
Environment variables: For dynamic values set outside Oh My Posh
-
Built-in segments: Many common use cases are covered by existing segments
The command segment was removed for the following reasons:
- Security: Arbitrary command execution in prompt rendering poses security risks
- Performance: Shell command execution can significantly slow down prompt rendering