-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: pre-select stuff with fzf #324
Conversation
Signed-off-by: Carlos Alexandro Becker <[email protected]>
Some questions
|
hmm, good question... would have to make it a bit more convoluted to explain it properly I believe...
Currently its using the same check it does for other fzf commands... so, yea, only on interactive prompts.
I think that highly depends on the fuzzy-finder... but specific to skim, judging by their docs, it seems it would work... |
cmd/kubectx/fzf.go
Outdated
@@ -50,7 +51,7 @@ func (op InteractiveSwitchOp) Run(_, stderr io.Writer) error { | |||
} | |||
kc.Close() | |||
|
|||
cmd := exec.Command("fzf", "--ansi", "--no-preview") | |||
cmd := exec.Command("fzf", "--ansi", "--no-preview", "-q", op.Target, "-1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets type out --query
and --select-1
explicitly, it's better for readability.
(ditto for kubens)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also to be clear, -q ""
works as we expect, right?
we could always do:
if query != "" {
args=append(args, "-q",query)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also to be clear,
-q ""
works as we expect, right?
yes it does, it passes an empty string, so it'll show the fzf screen as before...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok just wanted to make sure we're not relying on undocumented behavior (empty string vs unset)
yeah I think we can live without other fuzzy-finder supporting this feature (and can WARN the user if we don't know how to pass this arg down in case $FINDER is set) |
Signed-off-by: Carlos A Becker <[email protected]>
something to note is that when/if we introduce a custom $PICKER support, we now have to find a way that users can indicate to pass this $QUERY option in that value. e.g.:
and |
as discussed on twitter (https://twitter.com/caarlos0/status/1443410098471194625), PR adding this feature.
-
, switch right awayimplemented on both kubectx and kubens.
PS: would you also be interested in having a homebrew tap that uses the go versions? Right now I'm maintaining my own, but I can port the config here if you create a
homebrew-tap
repository :)Cheers!