refactor: extract sorted_subcommands helper to berhtjan-core scanner #4
Labels
No labels
coordination/cross-repo
coordination/needed
effort
large
effort
medium
effort
small
meta/duplicate
meta/planning
meta/wontfix
priority
high
priority
low
priority
medium
session
blocker
session
handover
session
next
status
blocked
status
done
status
in-progress
status
review
status
to-go
type
admin
type
bug
type
config
type
deployment
type
docs
type/documentation
type
enhancement
type
feature
type
handover
type
infrastructure
type
installation
type
maintenance
type
migration
type/refactor
type
research
type
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
DAW/daw-modul-berhtjan-core#4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Extract the repeated subcommand-sorting logic into a shared helper
scanner.sorted_subcommands(cmd)inberhtjan-core/scanner.lua.Current problem
The sort logic (by
orderfield, fallback alphabetical) is duplicated inthree places after the refactor in DAW/daw-modul-berhtjan-core#3:
berhtjan-core/scanner.lua-- insidebuild_indexberhtjan-cli/dispatch.lua-- insideprint_subcommandsberhtjan-cli/dispatch.lua-- insidebuild_usageProposed change
Add to
berhtjan-core/scanner.lua:Export via
berhtjan-core/init.luaasM.sorted_subcommands.build_indexinscanner.luaand both call sites indispatch.luareplace their inline sort with
scanner.sorted_subcommands(cmd).Acceptance criteria
sorted_subcommandsimplemented and exported from berhtjan-corebuild_indexuses itprint_subcommandsin dispatch.lua uses itbuild_usagein dispatch.lua uses itReferences
Resolved as part of the 2.1 migration (v2.1.0).
M.sorted_subcommands(cmd) added to scanner/index.lua, exported via the
facade, and used by both scanner.build_index() and
daw-modul-berhtjan-cli's dispatch/display.lua (replacing that repo's
local sorted_subs() duplicate). Hardened beyond the original proposal
with input validation (invalid_command, invalid_subcommands), since
it's a publicly exported function used by another repo.
Refs: DAW/daw-modul-berhtjan-cli (dispatch/display.lua)