k9s icon indicating copy to clipboard operation
k9s copied to clipboard

Add filter commandline parameter

Open NovemberZulu opened this issue 10 months ago • 4 comments

Summary

This PR adds -f/--filter commandline parameter that sets default filter

Testing

Manual tests, unit tests

NovemberZulu avatar Mar 25 '24 20:03 NovemberZulu

Thanks for proposing this PR! This is a missing feature I am looking forward to. It would be nice to have it because otherwise I have to manually type in the filter each time I enter k9s.

However, I tried this PR with ./k9s -n mork -f '-l service=MY_SERVICE' it does not show the filtered view when I entered the interface. Am I doing something wrong?

FWIW, when I type '/', I see -l service=MY_SERVICE in the filter history which saves me from typing.

vmingchen avatar Aug 28 '24 11:08 vmingchen

@vmingchen I haven't tested -l a=b initially. I pushed a new, hopefully less hacky, approach. It support both filter and -l a=b filters. I'll try to make codebeat happy,

NovemberZulu avatar Aug 29 '24 14:08 NovemberZulu

OK, codebeat is happy now. It feels like whack-a-mole, ngl. All in all, I am not sure that the current version is actually btter than 8207681e76dd80606e982b790aafbb658a283d9c. @derailed Could you please advise? 🙏

NovemberZulu avatar Aug 29 '24 15:08 NovemberZulu

Great! The '-l' filter is working for me now. Thanks a lot for the fix!

vmingchen avatar Aug 29 '24 21:08 vmingchen