Skip to content

fix: complete executables in fish for benchmark commands#896

Open
leno23 wants to merge 1 commit into
sharkdp:masterfrom
leno23:fix/fish-command-completion-872
Open

fix: complete executables in fish for benchmark commands#896
leno23 wants to merge 1 commit into
sharkdp:masterfrom
leno23:fix/fish-command-completion-872

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 26, 2026

Summary

  • Patch generated fish completions to complete executables from $PATH for positional benchmark command arguments via __fish_use_subcommand + __fish_complete_command.
  • Add ValueHint::CommandString to --reference so its value also completes executables in fish (matching --setup, --prepare, etc.).

Fixes #872

Notes

Zsh already uses _cmdstring for benchmark commands. Fish lacked positional command completion because clap_complete does not emit it for ValueHint::CommandString positional args.

Test plan

  • cargo fmt
  • cargo test
  • Verified generated hyperfine.fish contains __fish_use_subcommand completion and --reference uses __fish_complete_command

Made with Cursor

Add fish completion for positional benchmark commands using
__fish_complete_command, and mark --reference with CommandString so
its value completes executables as well.

Fixes sharkdp#872

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d9b8f46bee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread build.rs

fn patch_fish_completions(path: &Path) {
let mut content = fs::read_to_string(path).expect("read fish completions");
if !content.contains("__fish_use_subcommand") {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Guard fish patch with a unique marker

The contains("__fish_use_subcommand") check prevents the patch from being applied in practice. build_command() defines no subcommands, and clap_complete’s fish generator already emits __fish_use_subcommand in generated completions for that case, so hyperfine.fish will already contain this token before patching. As a result, FISH_COMMAND_COMPLETION is never appended and the positional executable completion fix does not take effect. Check for a marker unique to the injected snippet (for example the comment line or the full complete -c hyperfine ... (__fish_complete_command) string) instead.

Useful? React with 👍 / 👎.

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.

Shell not completing executables

1 participant