Skip to content

fix: register flag completion functions for config, log-dir, payload-dir, env#4413

Merged
lpcox merged 1 commit intomainfrom
fix/flag-completion-registration
Apr 23, 2026
Merged

fix: register flag completion functions for config, log-dir, payload-dir, env#4413
lpcox merged 1 commit intomainfrom
fix/flag-completion-registration

Conversation

@lpcox
Copy link
Copy Markdown
Collaborator

@lpcox lpcox commented Apr 23, 2026

Problem

TestRegisterFlagCompletions fails because MarkFlagFilename/MarkFlagDirname set flag annotations but don't register completion functions retrievable via Cobra's GetFlagCompletionFunc().

Fix

Replace annotation-based helpers with explicit RegisterFlagCompletionFunc calls that return the same directives (ShellCompDirectiveFilterFileExt for file flags, ShellCompDirectiveFilterDirs for directory flags). This makes completions both functional and testable.

Changes

  • internal/cmd/flags.go: Switch 4 flags from MarkFlagFilename/MarkFlagDirname to RegisterFlagCompletionFunc

Verification

make agent-finished passes with all checks green.

…dir, env

The previous implementation used MarkFlagFilename/MarkFlagDirname which
set annotations but did not register completion functions retrievable
via GetFlagCompletionFunc. Switch to RegisterFlagCompletionFunc so the
completions are both functional and testable.

Fixes TestRegisterFlagCompletions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 23, 2026 17:33
@lpcox lpcox merged commit 58190db into main Apr 23, 2026
14 checks passed
@lpcox lpcox deleted the fix/flag-completion-registration branch April 23, 2026 17:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Cobra flag completion registration so that completion functions are explicitly registered (and therefore discoverable/testable via GetFlagCompletionFunc()), resolving failing completion-related tests.

Changes:

  • Replaced MarkFlagFilename / MarkFlagDirname usage with explicit RegisterFlagCompletionFunc for --config, --log-dir, --payload-dir, and --env.
  • Kept completion directives consistent with prior behavior (FilterFileExt for file extensions, FilterDirs for directory completion).
Show a summary per file
File Description
internal/cmd/flags.go Registers explicit completion funcs for file/dir flags to make completions functional and testable.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

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.

2 participants