Skip to content

config --set: suggest similar configs when no exact match found (fixes #239)#242

Open
stakeswky wants to merge 1 commit intonbfc-linux:mainfrom
stakeswky:fix/config-set-fuzzy-suggestions
Open

config --set: suggest similar configs when no exact match found (fixes #239)#242
stakeswky wants to merge 1 commit intonbfc-linux:mainfrom
stakeswky:fix/config-set-fuzzy-suggestions

Conversation

@stakeswky
Copy link
Copy Markdown

Problem

When a user runs nbfc config --set "Thinkpad L540" but the actual config name is Lenovo Thinkpad L540, the command fails with a bare error message:

Error: No such configuration available: Thinkpad L540

There is no guidance on what the correct name might be or how to find it.

Fix

When an exact match is not found, compute Levenshtein-based similarity scores (reusing the existing str_similarity function) against all available configs and print any that meet the RecommendedConfigMatchThreshold (0.7):

Error: No such configuration available: Thinkpad L540
Did you mean one of these?
  Lenovo Thinkpad L540

If no close match exists, the user is pointed to nbfc config --list:

Error: No such configuration available: xyz
Use 'nbfc config --list' to see all available configurations.

No new dependencies — reuses str_similarity, ConfigFile_CompareByDiff, and RecommendedConfigMatchThreshold already present in the codebase.

Closes #239

When 'nbfc config --set <MODEL>' fails to find an exact match,
compute Levenshtein-based similarity scores against all available
configs and print any that meet the RecommendedConfigMatchThreshold
(0.7). If no close match exists, point the user to 'nbfc config --list'.

Fixes nbfc-linux#239
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.

[Bug]: sudo nbfc config --set "<MODEL>" should be sudo nbfc config --set "MODEL"

1 participant