Skip to content

fix(kubectl): stop context names starting with "-" from being misread as a flag - #100

Merged
plttn merged 1 commit into
mainfrom
push-xqwlvnurwnqr
Jul 28, 2026
Merged

fix(kubectl): stop context names starting with "-" from being misread as a flag#100
plttn merged 1 commit into
mainfrom
push-xqwlvnurwnqr

Conversation

@plttn

@plttn plttn commented Jul 28, 2026

Copy link
Copy Markdown
Owner

The CLI-fallback path in _tide_item_kubectl.fish (used when $KUBECONFIG lists multiple files, the default config doesn't exist, or the file didn't parse) passes kubectl's output straight to string replace without --:

string replace -r '/(|default)$' '' $context

A context named e.g. -staging makes $context start with -, so string replace reads it as an unknown option instead of the string to operate on. Same bug as the one just fixed in _tide_pwd.fish (#98), just in a different file.

Add -- before $context, and a regression test for a context name starting with -.

@plttn
plttn merged commit 27fcdf0 into main Jul 28, 2026
7 checks passed
@plttn
plttn deleted the push-xqwlvnurwnqr branch July 28, 2026 18:19
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