Skip to content

feat(cli): suggest closest command or option on typos - #69

Merged
Chemaclass merged 1 commit into
mainfrom
feat/cli-did-you-mean
Sep 25, 2026
Merged

Chemaclass merged 1 commit into
mainfrom
feat/cli-did-you-mean

Conversation

@Chemaclass

Copy link
Copy Markdown
Owner

Why

bashdep instal printed one error line followed by 25 lines of usage. The actual mistake got buried.

What

$ bashdep instal
Error: Unknown command 'instal'. Did you mean 'install'?
Run 'bashdep --help' for usage.

$ bashdep install --dryrun
Error: Unknown option '--dryrun'. Did you mean '--dry-run'?
  • Suggests the closest match within two edits. No match: just the error and the --help hint.
  • --job=2 matches on the flag name, so it suggests --jobs.
  • Command and flag lists move to BASHDEP_COMMANDS / BASHDEP_FLAGS, shared with completion.
  • Edit distance in awk. No new runtime dependency.

Test plan

  • 6 new tests (helper, command, option, =value option, no-match hint)
  • Manual check on bash 3.2 and macOS awk
  • make check green

@Chemaclass
Chemaclass force-pushed the feat/cli-did-you-mean branch from 0efffee to f36ee08 Compare September 25, 2026 10:10
@Chemaclass
Chemaclass merged commit 20e647d into main Sep 25, 2026
6 checks passed
@Chemaclass
Chemaclass deleted the feat/cli-did-you-mean branch September 25, 2026 10:11
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