enh: substring filter for the board picker#9843
Conversation
Run shfmt -w on lib/functions/configuration/interactive.sh to normalise pre-existing indentation drift (tabs vs spaces, comment alignment) so that a follow-up substring-filter change in interactive_config_ask_board_list shows up as a clean diff. No behaviour change. Assisted-by: Claude:claude-opus-4.7
…bshells
`get_list_of_all_buildable_boards` is called once per redraw of the
interactive board picker (initial open, Show CSC/WIP/EOS/TVB toggle,
and any other dialog re-render). Two things made each call expensive
in proportion to the number of boards (~400 in the tree):
1. Per board file it forked `basename | cut` and `head | cut` -- two
subshell pipelines per file, ~800 fork/exec cycles per scan.
2. The result was thrown away and recomputed on the next loop
iteration even when nothing had changed.
This commit:
- Replaces the per-file subshells with bash parameter expansion
(`${path##*/}`, `${name%.*}`, `${line#*#}`, `${line%%#*}`) plus a
single `read -r` for the first line of each board file. Behaviour
is equivalent to the previous `basename`/`cut`/`head` chain.
- Hoists the result arrays out of the while loop and re-scans only
when `WIP_STATE` flips on the Show-CSC/WIP/EOS/TVB toggle, the
only event that changes the set of types considered.
Visible effect: the "Generating list of all available boards" delay
on entering the picker stays the same, but redraws that previously
incurred the same delay (toggle, future filter changes) are now
instantaneous.
Assisted-by: Claude:claude-opus-4.7
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis pull request optimizes the interactive board selection interface in Armbian's build configuration system. Board metadata extraction is streamlined to use native bash parameter expansion instead of external command pipelines. The board list selection dialog gains a caching mechanism to avoid re-scanning on every redraw and introduces substring filtering via menu sentinels, with filter state persisted across selections. Adjacent functions receive formatting normalization with no logic changes. ChangesInteractive Board Selection and Filtering
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/functions/configuration/interactive.sh`:
- Around line 158-179: The filter is matching the raw dialog payload (which
includes color escapes and a leading "(type)" badge) so searches hit those
tokens; modify the loop that builds arr_filter_hits (involving
arr_all_board_options, item, tag, hay) to first strip dialog color escape
sequences like \Z1...\Zn and remove a leading "(...)" type badge from item
(produce a cleaned_item), then perform the case-insensitive match against
"${tag,,} ${cleaned_item,,}" instead of against the raw item; keep the rest
(arr_filter_hits population, match_count, and arr_menu_options with
FILTER_TAG/CLEAR_TAG) unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 9f16eec4-3c55-441a-971b-e4ed17963d3f
📒 Files selected for processing (1)
lib/functions/configuration/interactive.sh
When BOARD is not set on the command line, the interactive board picker
shows all 400+ boards alphabetically with no built-in way to narrow the
list down. Finding a known board by typing only its first letter (the
default dialog behaviour) is impractical when several share a prefix.
Prepend a sentinel `[set filter]` entry at the top of the menu that
opens a dialog --inputbox; the substring is matched case-insensitively
against both the board name and its short description. Once a filter is
active, a second sentinel `[clear filter]` appears alongside, and the
first sentinel shows the current filter and match count.
Implementation notes:
- A separate dialog button (e.g. --help-button) was tried first but it
doesn't fit in an 80x24 terminal alongside the existing OK / Show
CSC.. / Cancel triplet -- dialog returns 255 ("screen too small")
before the user can react. A sentinel menu entry has no such
constraint and keeps the existing button layout intact.
- Filter state survives the existing CSC/WIP/EOS toggle and re-filtering
on a fresh full list, so toggling expert mode does not lose the
substring.
- Filtering iterates the cached arr_all_board_options in pure bash
(no subshells), so it stays cheap regardless of how many times the
user re-opens the inputbox.
Assisted-by: Claude:claude-opus-4.7
7113743 to
25336d3
Compare
Summary
Add a substring filter to the interactive board picker (
./compile.shwhenBOARDis not set). With ~400 supported boards the alphabetical list is long; the dialog's built-in first-letter navigation is impractical when many boards share a prefix. The PR introduces a[set filter]sentinel at the top of the menu that opens adialog --inputbox; matching is case-insensitive on both the board name and the description line.Bundled with two related changes that make the picker itself snappier (see commits below) — without them, opening / toggling / filtering the picker each pays a ~800-fork-per-redraw cost.
Behaviour
[set filter]. All boards remain visible, no buttons added, no layout shift.[clear filter]appears, and the first sentinel's description showschange filter (current: <X>, <N>/<TOTAL> boards). Only matching boards are listed beneath.Show CSC/WIP/EOS/TVBtoggle.Screens
Before — current behaviour with no sentinel, no filter:
After (no filter) — new sentinel at top:
Filter inputbox:
Filter active — 2/367 boards match
helios:Why a sentinel and not a button
The first attempt added
--help-button --help-label "Filter"to the existing--menu. In a standard 80×24 PuTTY/xterm the four buttons (OK, Show CSC.., Cancel, Filter) plus the menu items don't fit;dialogreturns 255 ("screen too small") before the user can interact. A sentinel menu entry sidesteps that — no extra button, no layout change.Commits
interactive: shfmt whole-file format pass— formatting-only pass onlib/functions/configuration/interactive.shso the substantive diffs that follow show up clean. No behaviour change.interactive: cache board list across dialog redraws, drop per-file subshells—get_list_of_all_buildable_boardspreviously forkedbasename | cutandhead | cutper board file (~800 forks for ~400 boards) and re-ran on every dialog redraw. Replaces the subshells with bash parameter expansion + a singleread -r, and hoists the result out of the while loop so it only re-scans whenWIP_STATEchanges (Show CSC/WIP/EOS/TVB toggle).interactive: substring filter for the board picker— the actual feature, ~45 lines added ininteractive_config_ask_board_list.Test plan
./compile.sh build→ dialog shows[set filter]at top alongside all boards[set filter]→ typehelios→ menu shows[set filter](withcurrent: helios, 2/367),[clear filter],helios4,helios64[clear filter]→ full list returns, only[set filter]sentinel remainsShow CSC/WIP/EOS/TVBwhile a filter is active → filter persists, re-scan happens once--help-buttonaddedSummary by CodeRabbit
New Features
Performance