Skip to content

fix: correct fish completion output#213

Open
keta1 wants to merge 1 commit into
rgcr:mainfrom
keta1:fix/fish-completions
Open

fix: correct fish completion output#213
keta1 wants to merge 1 commit into
rgcr:mainfrom
keta1:fix/fish-completions

Conversation

@keta1
Copy link
Copy Markdown

@keta1 keta1 commented May 12, 2026

Description

This fixes fish completion output for m-cli. The fish completion parser currently uses string match in conditionals without quiet mode, which can leak matched option names as duplicate completion candidates.

The duplicate output can be reproduced with fish's complete -C builtin, which computes completions for a supplied command line.

Before:

$ fish -c 'complete -C "m battery "'
  --help
  --status
--help    Show this help message
--status  Show the current battery status

After:

$ fish -c 'complete -C "m battery "'
--help    Show this help message
--status  Show the current battery status

This also quotes parsed help lines and completion tokens to avoid empty/glob-like matching surprises, and completes option values before falling back to option-name completions.

Verification

  • fish -n completions/fish/m.fish
  • fish -c 'complete -C "m battery --"' only shows --help and --status once
  • fish -c 'complete -C "m appearance --darkmode "' completes disable and enable
  • fish -c 'complete -C "m appearance --iconsize m"' completes medium

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