
It would be nice if there was a keyboard shortcut to just save yaml of current selected component to clipboard.
CTRL-Y for example.
This would enable quick copy/paste of resources from k8s to somewhere else.
I actually also wanted this feature. I started already thinking about implementing it myself using plugins, but it looks like plugins don't support the yaml view as a scope. What do you think, would it be better to add more scopes so you could use a plugin to do this, or make this a part of k9s itself? I suppose all clipboard libs for go require external apps for them to function (at least this is the one I found: https://github.com/atotto/clipboard). As they require external apps, plugins would be a great fit for this, but then again this could function just as the "save" feature. As that already saves whatever is the current view and copying to clipboard could use the same logic
Hey @kapodes and @syvanpera, thanks for this request.
I think it make a lot of sense to integrate this inside of k9s. We already use atotto/clipboard (and yes it does need external tools @syvanpera) for the feature of copying the name of a resource with c when we are on the list view. Maybe we could make the shortcut c to copy the whole YAML when in the YAML view.
So the workflow would be:
:poycWhat do you both think?
/cc @derailed
Sounds good, although using the Ctrl-Y or something like that would make sense if we'd like to make this work like the save command does. So basically just do the same thing as save now does, but only writing the result (csv, yaml whatever) to clipboard. I actually have quick and dirty version of this already working
Ah, nevermind. Of course the 'c' command works just as well, I mixed things up
But just not limiting this to only copy the yaml, but also copy whatever save command can save also.
Both c and ctrl-Y work for me. The ctrl makes more sense just for this but ‘c’ is better if it will work on other screens
Yeah, and I didn't notice that there already is a copy command that uses 'c', so it makes sense to use the same shortcut
Ah, but I just realized that the 'c' command only copies the current resource from the list. Okay, I guess that could work. I for one don't currently have any use for copying the list as a csv to clipboard at this time.
Can I take a stab at implementing this?
Yes! Thanks you both for the input on this request.
Of course you can implement this! If you need any help just send me a message and I can help you.
Already done, let me know if it's not up to par
@kapodes Should be fixed in 0.9.2! Thanks to @syvanpera awesome PR!!
Most helpful comment
Already done, let me know if it's not up to par