Skip to content

fix(cmd): keep the -f flag when a command line is rebuilt - #4356

Merged
uozalp merged 1 commit into
derailed:masterfrom
b84330808:fix-cmd-fuzzy-flag-roundtrip
Nov 3, 2026
Merged

uozalp merged 1 commit into
derailed:masterfrom
b84330808:fix-cmd-fuzzy-flag-roundtrip

Conversation

@b84330808

Copy link
Copy Markdown
Contributor

:pod -f fred drops its fuzzy filter. args.String() writes the fuzzy value without its -f flag, so Interpreter.Merge turns pod -f fred into pod fred. Command.run then calls SwitchNS, which re-parses the line: fred is read back as a namespace, the active namespace replaces it, and FuzzyArg() returns nothing. The history entry ends up as v1/pods fred default.

This writes the fuzzy value back as -f <value>, like the filter and context values next to it.

TestMergeKeepsFuzzyFilter runs Merge and SwitchNS on pod -f fred, pod -ffred and a namespace switch. Before the change it fails (expected: "pod -f fred", actual : "pod fred", and FuzzyArg() empty); after it, it passes, and go test ./internal/view/cmd/ ./internal/view/ passes.

Fixes #4354

I used Claude Code to write this change.

args.String() wrote the fuzzy filter value without its -f flag, so
Interpreter.Merge turned `pod -f fred` into `pod fred`. Command.run
merges the interpreter and then calls SwitchNS, which re-parses the
line, so `fred` was read back as a namespace, the active namespace
replaced it, and FuzzyArg() came back empty: `:pod -f fred` lost its
fuzzy filter, and the history entry read `v1/pods fred default`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@uozalp uozalp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@b84330808 Thanks for the update

@uozalp
uozalp merged commit 371cfb4 into derailed:master Nov 3, 2026
3 checks passed
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.

:pod -f <text> loses the fuzzy filter

2 participants