Skip to content

Reset flag state before completion#83

Open
M09Ic wants to merge 1 commit into
reeflective:mainfrom
M09Ic:pr/console-completion-flag-state
Open

Reset flag state before completion#83
M09Ic wants to merge 1 commit into
reeflective:mainfrom
M09Ic:pr/console-completion-flag-state

Conversation

@M09Ic

@M09Ic M09Ic commented Jun 27, 2026

Copy link
Copy Markdown

Background

Console completion reuses cobra command trees. Flags parsed by an earlier completion or execution can leave Changed, values, and ArgsLenAtDash state behind, which can influence later completion results for the same command tree.

Approach

  • Locate the command being completed from the current input words.
  • Reset that command's flag values and Changed state before invoking carapace completion.
  • Reset ArgsLenAtDash on the target command and its parents.
  • Keep this scoped to the completion path.

Tests

  • Added coverage that a previously changed bool flag is restored before completion.
  • Added coverage that ArgsLenAtDash is restored after a previous parse containing --.
  • Ran go test ./...

@M09Ic M09Ic force-pushed the pr/console-completion-flag-state branch from 9152b2b to d62f7dd Compare June 27, 2026 01:53
@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 67.39130% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 24.82%. Comparing base (7002774) to head (d62f7dd).

Files with missing lines Patch % Lines
completer.go 67.39% 10 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #83      +/-   ##
==========================================
+ Coverage   22.54%   24.82%   +2.27%     
==========================================
  Files          27       27              
  Lines        2045     2091      +46     
==========================================
+ Hits          461      519      +58     
+ Misses       1554     1533      -21     
- Partials       30       39       +9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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