cli icon indicating copy to clipboard operation
cli copied to clipboard

[WIP] Completion for events --filter

Open albers opened this issue 1 year ago • 3 comments

Adds completion for the docker events --filter family.

@thaJeztah PTAL. This is in an early stage (only some filters implemented yet), and I would like to get early feedback whether I'm on the right track here.

For ContainerNames and NetworkNames I reuse existing completion functions in a hacky way. I think we will hit more use cases like this, and a better solution would be appropriate.

Therefore I propose to pull out helper functions that just return the names (which I need here) from the existing helper functions. Now I run into naming issues. Using the network example, the new function should be named NetworkNames, which forces me to rename the existing one to something like CompleteNetworkNames or NetworkNameCompletions.

To stay consistent, this would mean other completion helpers should be renamed as well, e.g. EnvVarNames -> CompleteEnvVarNames and VolumeNames -> CompleteVolumeNames.

WDYT?

albers avatar Oct 17 '24 13:10 albers

Codecov Report

Attention: Patch coverage is 70.37037% with 32 lines in your changes missing coverage. Please review.

Project coverage is 59.64%. Comparing base (21eea1e) to head (e1c5180). Report is 183 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5538      +/-   ##
==========================================
- Coverage   60.67%   59.64%   -1.03%     
==========================================
  Files         345      346       +1     
  Lines       23491    29211    +5720     
==========================================
+ Hits        14252    17422    +3170     
- Misses       8266    10819    +2553     
+ Partials      973      970       -3     

codecov-commenter avatar Oct 17 '24 13:10 codecov-commenter

@thaJeztah I just stepped over your completion tests. I'll take a look at it and try to add tests for the completions in this PR.

albers avatar Oct 19 '24 16:10 albers

@thaJeztah I added tests for those commands that call the API. Please take a look before I clean up the commits and publish the PR.

albers avatar Oct 22 '24 12:10 albers

The PR is ready for review now.

albers avatar Oct 24 '24 22:10 albers

@thaJeztah Thanks for the review, I applied all of your suggestions. PTAL.

albers avatar Oct 29 '24 12:10 albers

@thaJeztah Thanks for the review, I applied all of your suggestions. PTAL.

Thank you! Changes LGTM, but it's ok to squash my suggestions with the first commit (we don't need the history of the "review comments applied"). Could you squash the first and last commit?

thaJeztah avatar Oct 29 '24 14:10 thaJeztah

Could you squash the first and last commit?

done.

albers avatar Oct 29 '24 16:10 albers