Skip to content

theme - powerline-naked: add missing parameter expansions.#751

Open
allan-kg wants to merge 1 commit intoohmybash:masterfrom
allan-kg:01-fix-theme-powerline-naked
Open

theme - powerline-naked: add missing parameter expansions.#751
allan-kg wants to merge 1 commit intoohmybash:masterfrom
allan-kg:01-fix-theme-powerline-naked

Conversation

@allan-kg
Copy link
Copy Markdown
Contributor

@allan-kg allan-kg commented Apr 4, 2026

Enable parameter expansions that can be set with exports outside of the script without read-only variables.

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Review Summary by Qodo

Add parameter expansions to powerline-naked theme variables

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Add parameter expansion support for all hardcoded theme variables
• Enable external configuration via POWERLINE_* environment variables
• Replace hardcoded values with ${POWERLINE_*:=default} pattern
• Maintain backward compatibility with default values
Diagram
flowchart LR
  A["Hardcoded theme values"] -->|"Add parameter expansion"| B["POWERLINE_* environment variables"]
  B -->|"With defaults"| C["Configurable theme settings"]
  C -->|"Backward compatible"| D["Existing behavior preserved"]
Loading

Grey Divider

File Changes

1. themes/powerline-naked/powerline-naked.theme.sh ✨ Enhancement +27/-27

Convert hardcoded theme variables to configurable parameters

• Converted 24 hardcoded theme color and text variables to use parameter expansion syntax
• Added POWERLINE_* prefixed environment variable support for all theme customization options
• Maintained default values using ${VAR:=default} pattern for backward compatibility
• Affected variables include user info colors, SCM colors, Ruby colors, battery status colors, clock
 color, CWD color, and VIM indicator settings

themes/powerline-naked/powerline-naked.theme.sh


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

qodo-free-for-open-source-projects bot commented Apr 4, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX Issues (0)

Grey Divider


Remediation recommended

1. Dead SCM color fallback 🐞 Bug ⚙ Maintainability
Description
SCM_THEME_PROMPT_COLOR is assigned twice; the first ${POWERLINE_SCM_THEME_PROMPT_COLOR:=238}
ensures POWERLINE_SCM_THEME_PROMPT_COLOR is set, so the later
${POWERLINE_SCM_THEME_PROMPT_COLOR:=${SCM_THEME_PROMPT_CLEAN_COLOR}} fallback can never apply.
This also diverges from other powerline themes where SCM_THEME_PROMPT_COLOR defaults to
SCM_THEME_PROMPT_CLEAN_COLOR, making the configuration logic misleading and fragile if
SCM_THEME_PROMPT_COLOR is later relied upon.
Code

themes/powerline-naked/powerline-naked.theme.sh[R21-26]

+SCM_THEME_PROMPT_COLOR=${POWERLINE_SCM_THEME_PROMPT_COLOR:=238}
+SCM_THEME_PROMPT_CLEAN_COLOR=${POWERLINE_SCM_THEME_PROMPT_CLEAN_COLOR:=25}
+SCM_THEME_PROMPT_DIRTY_COLOR=${POWERLINE_SCM_THEME_PROMPT_DIRTY_COLOR:=88}
+SCM_THEME_PROMPT_STAGED_COLOR=${POWERLINE_SCM_THEME_PROMPT_STAGED_COLOR:=30}
+SCM_THEME_PROMPT_UNSTAGED_COLOR=${POWERLINE_SCM_THEME_PROMPT_UNSTAGED_COLOR:=92}
+SCM_THEME_PROMPT_COLOR=${POWERLINE_SCM_THEME_PROMPT_COLOR:=${SCM_THEME_PROMPT_CLEAN_COLOR}}
Evidence
In powerline-naked, line 21 uses :=238 which assigns POWERLINE_SCM_THEME_PROMPT_COLOR when
unset/null; therefore by the time line 26 runs, POWERLINE_SCM_THEME_PROMPT_COLOR is already set
and the default word ${SCM_THEME_PROMPT_CLEAN_COLOR} is never used. Other powerline themes set
SCM_THEME_PROMPT_COLOR directly from SCM_THEME_PROMPT_CLEAN_COLOR, indicating the intended
default relationship.

themes/powerline-naked/powerline-naked.theme.sh[17-26]
themes/powerline/powerline.theme.sh[17-26]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`themes/powerline-naked/powerline-naked.theme.sh` assigns `SCM_THEME_PROMPT_COLOR` twice. The first assignment initializes `POWERLINE_SCM_THEME_PROMPT_COLOR` to `238`, which prevents the later assignment from ever falling back to `SCM_THEME_PROMPT_CLEAN_COLOR`.

### Issue Context
Other powerline themes set `SCM_THEME_PROMPT_COLOR` to track `SCM_THEME_PROMPT_CLEAN_COLOR` by default. The current ordering makes the fallback unreachable and changes the default relationship.

### Fix Focus Areas
- themes/powerline-naked/powerline-naked.theme.sh[21-26]

### Suggested change
- Remove the first initialization (line 21), and keep a single assignment that defaults to `SCM_THEME_PROMPT_CLEAN_COLOR`, e.g.:
 - define `SCM_THEME_PROMPT_CLEAN_COLOR` first
 - then `SCM_THEME_PROMPT_COLOR=${POWERLINE_SCM_THEME_PROMPT_COLOR:=${SCM_THEME_PROMPT_CLEAN_COLOR}}`

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant